From 0a1c65db17ebfc2d50ef91d4f98c8327c8d172cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 27 Nov 2011 13:33:44 +0100 Subject: [PATCH] Avoid caching of old versions of JS-File --- file/lib/page/ChatPage.class.php | 28 +++++++++++++++++++++++++--- template/chatJavascriptInclude.tpl | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index c51e190..06577d5 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -1,7 +1,8 @@ assign(array( + 'chatVersion' => $this->chatVersion, 'room' => $this->room, 'roomID' => $this->roomID, 'rooms' => $this->rooms, @@ -34,6 +37,20 @@ public function assignVariables() { )); } + public function readChatVersion() { + CacheHandler::getInstance()->addResource( + 'packages', + WCF_DIR.'cache/cache.packages.php', + 'wcf\system\cache\builder\PackageCacheBuilder' + ); + $packages = CacheHandler::getInstance()->get('packages'); + foreach ($packages as $package) { + if ($package->package != 'timwolla.wcf.chat') continue; + $this->chatVersion = $package->packageVersion; + break; + } + } + /** * @see \wcf\page\IPage::readData() */ @@ -69,8 +86,8 @@ public function readData() { 'color2' => 0x00FF00 )); - $smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies(); - $this->smilies = $smilies[null]; + $this->readDefaultSmileys(); + $this->readChatVersion(); } /** @@ -82,6 +99,11 @@ public function readParameters() { if (isset($_GET['id'])) $this->roomID = (int) $_GET['id']; } + public function readDefaultSmileys() { + $smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies(); + $this->smilies = $smilies[null]; + } + /** * @see \wcf\page\IPage::show() */ diff --git a/template/chatJavascriptInclude.tpl b/template/chatJavascriptInclude.tpl index 9a793e9..70a3857 100644 --- a/template/chatJavascriptInclude.tpl +++ b/template/chatJavascriptInclude.tpl @@ -1 +1 @@ -{if $templateName == 'chat'}{/if} \ No newline at end of file +{if $templateName == 'chat'}{/if} \ No newline at end of file