mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Avoid caching of old versions of JS-File
This commit is contained in:
parent
8114472189
commit
0a1c65db17
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace wcf\page;
|
||||
use \wcf\system\WCF;
|
||||
use \wcf\data\chat;
|
||||
use \wcf\system\cache\CacheHandler;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Shows the chat-interface
|
||||
@ -13,6 +14,7 @@
|
||||
* @subpackage page
|
||||
*/
|
||||
class ChatPage extends AbstractPage {
|
||||
public $chatVersion = '';
|
||||
//public $neededModules = array('CHAT_ACTIVE');
|
||||
//public $neededPermissions = array('user.chat.canEnter');
|
||||
public $room = null;
|
||||
@ -27,6 +29,7 @@ public function assignVariables() {
|
||||
parent::assignVariables();
|
||||
|
||||
WCF::getTPL()->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()
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
{if $templateName == 'chat'}<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/TimWolla.WCF.Chat.js"></script>{/if}
|
||||
{if $templateName == 'chat'}<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/TimWolla.WCF.Chat.js{if $chatVersion|isset}?version={$chatVersion}{/if}"></script>{/if}
|
Loading…
Reference in New Issue
Block a user