diff --git a/file/lib/data/room/Room.class.php b/file/lib/data/room/Room.class.php index ed864c6..37eadc0 100644 --- a/file/lib/data/room/Room.class.php +++ b/file/lib/data/room/Room.class.php @@ -1,7 +1,6 @@ - */ - protected static $cache = null; - /** * @see \wcf\data\chat\room\ChatRoom::getTitle(); */ @@ -121,16 +113,7 @@ public function countUsers() { * Loads the room cache. */ public static function getCache() { - if (self::$cache === null) { - CacheHandler::getInstance()->addResource( - 'chatRooms', - CHAT_DIR.'cache/cache.rooms.php', - '\chat\system\cache\builder\RoomCacheBuilder' - ); - self::$cache = CacheHandler::getInstance()->get('chatRooms'); - } - - return self::$cache; + return \chat\system\cache\builder\RoomCacheBuilder::getInstance()->getData(); } /** diff --git a/file/lib/data/room/RoomEditor.class.php b/file/lib/data/room/RoomEditor.class.php index 6b1e4ab..0bb25f5 100644 --- a/file/lib/data/room/RoomEditor.class.php +++ b/file/lib/data/room/RoomEditor.class.php @@ -59,6 +59,7 @@ public static function deleteAll(array $objectIDs = array()) { * Clears the room cache. */ public static function resetCache() { - \wcf\system\cache\CacheHandler::getInstance()->clear(CHAT_DIR.'cache', 'cache.rooms.php'); + \chat\system\cache\builder\RoomCacheBuilder::getInstance()->reset(); + \chat\system\cache\builder\PermissionCacheBuilder::getInstance()->reset(); } } diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index aeecc49..6a0dbc3 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -1,7 +1,6 @@ add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'))); $conditionBuilder->add('option_to_group.optionID = acl_option.optionID'); - $conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs)); + $conditionBuilder->add('option_to_group.groupID IN (?)', array($parameters)); $sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue, acl_option.optionName AS permission FROM wcf".WCF_N."_acl_option acl_option, diff --git a/file/lib/system/cache/builder/RoomCacheBuilder.class.php b/file/lib/system/cache/builder/RoomCacheBuilder.class.php index 47f7f3d..f08969d 100644 --- a/file/lib/system/cache/builder/RoomCacheBuilder.class.php +++ b/file/lib/system/cache/builder/RoomCacheBuilder.class.php @@ -10,11 +10,11 @@ * @package be.bastelstu.chat * @subpackage system.cache.builder */ -class RoomCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder { +class RoomCacheBuilder implements \wcf\system\cache\builder\AbstractCacheBuilder { /** - * @see \wcf\system\cache\ICacheBuilder::getData() + * @see \wcf\system\cache\AbstractCacheBuilder::rebuild() */ - public function getData(array $cacheResource) { + public function rebuild(array $parameters) { // get all chat rooms $roomList = new \chat\data\room\RoomList(); $roomList->sqlOrderBy = "room.position"; diff --git a/file/lib/system/permission/PermissionHandler.class.php b/file/lib/system/permission/PermissionHandler.class.php index a47b84d..9af5c00 100644 --- a/file/lib/system/permission/PermissionHandler.class.php +++ b/file/lib/system/permission/PermissionHandler.class.php @@ -1,7 +1,6 @@ getGroupIDs()); - $groupsFileName = \wcf\util\StringUtil::getHash(implode('-', $user->getGroupIDs())); - CacheHandler::getInstance()->addResource('permission-'.$groups, WCF_DIR.'cache/cache.permission-'.$groupsFileName.'.php', '\chat\system\cache\builder\PermissionCacheBuilder'); - $this->chatPermissions = CacheHandler::getInstance()->get('permission-'.$groups); + $this->chatPermissions = \chat\system\cache\builder\PermissionCacheBuilder::getInstance()->getData($user->getGroupIDs); // get user permissions if ($user->userID) { @@ -106,6 +102,6 @@ public static function clearCache() { $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush->resetAll('chatUserPermissions', $packageID); - \wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.permission-[a-f0-9]{40}.php'); + \chat\system\cache\builder\PermissionCacheBuilder::getInstance()->reset(); } }