Renamed cache builders (II)
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Aug 2011 06:19:52 +0000 (08:19 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Aug 2011 06:19:52 +0000 (08:19 +0200)
17 files changed:
wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php
wcfsetup/install/files/lib/acp/page/UserListPage.class.php
wcfsetup/install/files/lib/data/style/ActiveStyle.class.php
wcfsetup/install/files/lib/data/user/User.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/WCFACP.class.php
wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php
wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php
wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php
wcfsetup/install/files/lib/system/event/EventHandler.class.php
wcfsetup/install/files/lib/system/language/LanguageFactory.class.php
wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php
wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php
wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php
wcfsetup/install/files/lib/system/session/SessionHandler.class.php
wcfsetup/install/files/lib/system/style/StyleHandler.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php

index ded1777342fd168dcfe656cd37bce1b386c255cd..dea4920e8588436fe2e2c37c1a7a9375ef022c01 100755 (executable)
@@ -39,7 +39,7 @@ abstract class AbstractOptionListForm extends AbstractForm {
         * cache class name
         * @var string
         */
-       public $cacheClass = 'wcf\system\cache\builder\CacheBuilderOption';
+       public $cacheClass = 'wcf\system\cache\builder\OptionCacheBuilder';
 
        /**
         * list of all option categories
index f275f474e81cd417dd7bd54d3485dca2f275fc4c..8f9a76eb8bfc1b1a6774f8040051a3a8a0b527d8 100755 (executable)
@@ -270,11 +270,12 @@ class UserListPage extends SortablePage {
         * Gets the user options from cache.
         */
        protected function readUserOptions() {
-               // add cache resource
                $cacheName = 'user-option-'.PACKAGE_ID;
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderOption');
-               
-               // get options
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\OptionCacheBuilder
+               ');
                $this->options = CacheHandler::getInstance()->get($cacheName, 'options');
        }
        
index 534c86f2ad1944d6b085463be94ea552fc344825..15b82e630a919d7278d7a893d39eefdc31bd69dc 100644 (file)
@@ -41,8 +41,13 @@ class ActiveStyle extends DatabaseObjectDecorator {
                }
                
                // load icon cache
-               WCF::getCache()->addResource('icon-'.PACKAGE_ID.'-'.$this->styleID, WCF_DIR.'cache/cache.icon-'.PACKAGE_ID.'-'.$this->styleID.'.php', 'wcf\system\cache\builder\CacheBuilderIcon');
-               $this->iconCache = WCF::getCache()->get('icon-'.PACKAGE_ID.'-'.$this->styleID);
+               $cacheName = 'icon-'.PACKAGE_ID.'-'.$this->styleID;
+               WCF::getCache()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\IconCacheBuilder'
+               );
+               $this->iconCache = WCF::getCache()->get($cacheName);
        }
        
        /**
index c2218ffe9675450bd3cae7e172ab4e5544c9a22f..4a021020726dbb846e118b4476c8dba3b23b2ff1 100644 (file)
@@ -174,7 +174,11 @@ class User extends DatabaseObject {
         */
        protected static function getUserOptionCache() {
                $cacheName = 'user-option-'.PACKAGE_ID;
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderOption');
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\OptionCacheBuilder'
+               );
                self::$userOptions = CacheHandler::getInstance()->get($cacheName, 'options');
        }
        
index bdf91a8b3bd66448fc22dbb2e6b96d31fde3977d..7e4f803a47dbae0d40f407fea6e1130c4bcd01c8 100644 (file)
@@ -288,10 +288,23 @@ class WCF {
         * Loads the default cache resources.
         */
        protected function loadDefaultCacheResources() {
-               CacheHandler::getInstance()->addResource('languages', WCF_DIR.'cache/cache.languages.php', 'wcf\system\cache\builder\CacheBuilderLanguage');
-               CacheHandler::getInstance()->addResource('spiders', WCF_DIR.'cache/cache.spiders.php', 'wcf\system\cache\builder\CacheBuilderSpider');
+               CacheHandler::getInstance()->addResource(
+                       'languages',
+                       WCF_DIR.'cache/cache.languages.php',
+                       'wcf\system\cache\builder\LanguageCacheBuilder'
+               );
+               CacheHandler::getInstance()->addResource(
+                       'spiders',
+                       WCF_DIR.'cache/cache.spiders.php',
+                       'wcf\system\cache\builder\SpiderCacheBuilder'
+               );
+               
                if (defined('PACKAGE_ID')) {
-                       CacheHandler::getInstance()->addResource('coreObjects-'.PACKAGE_ID, WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderCoreObject');
+                       CacheHandler::getInstance()->addResource(
+                               'coreObjects-'.PACKAGE_ID,
+                               WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php',
+                               'wcf\system\cache\builder\CoreObjectCacheBuilder'
+                       );
                }
        }
        
index d2f6cc762b12c7c53ba2a1f4ab572839ab42842c..e561cfca5b17b0745b16490ca0d6f167120f4837 100644 (file)
@@ -93,7 +93,12 @@ class WCFACP extends WCF {
         */
        protected function loadDefaultCacheResources() {
                parent::loadDefaultCacheResources();
-               CacheHandler::getInstance()->addResource('packages', WCF_DIR.'cache/cache.packages.php', 'wcf\system\cache\builder\CacheBuilderPackage');
+               
+               CacheHandler::getInstance()->addResource(
+                       'packages',
+                       WCF_DIR.'cache/cache.packages.php',
+                       'wcf\system\cache\builder\PackageCacheBuilder'
+               );
        }
        
        /**
index 82c452aa898aa9a1c1e6ea647114202d32c1f176..df3f41c594ab23698000678cc8716124cb6139b4 100644 (file)
@@ -24,12 +24,13 @@ class ApplicationHandler extends SingletonFactory {
         * Initializes cache.
         */
        protected function init() {
+               $cacheName = 'application-'.PACKAGE_ID;
                CacheHandler::getInstance()->addResource(
-                       'application-'.PACKAGE_ID,
-                       WCF_DIR.'cache/cache.application-'.PACKAGE_ID.'.php',
-                       'wcf\system\cache\builder\CacheBuilderApplication'
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\ApplicationCacheBuilder'
                );
-               $this->cache = CacheHandler::getInstance()->get('application-'.PACKAGE_ID);
+               $this->cache = CacheHandler::getInstance()->get($cacheName);
        }
        
        /**
index 0d920bf39c8741d07913435dfcd0a190754e0b99..8d88ad3b5b0cd53242219536b5d94d0ad852d893 100644 (file)
@@ -47,13 +47,14 @@ class CleanupHandler {
         * Loads cleanup adapter cache.
         */
        protected function loadCache() {
+               $cacheName = 'cleanupAdapter-'.PACKAGE_ID;
                CacheHandler::getInstance()->addResource(
-                       'cleanupAdapter-'.PACKAGE_ID,
-                       WCF_DIR.'cache/cache.cleanupAdapter.php',
-                       'wcf\system\cache\builder\CacheBuilderCleanupAdapter'
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\CleanupAdapterCacheBuilder'
                );
                
-               $this->cache = CacheHandler::getInstance()->get('cleanupAdapter-'.PACKAGE_ID);
+               $this->cache = CacheHandler::getInstance()->get($cacheName);
        }
        
        /**
index e06007e4c3b02ce00c5fdd87c4e3cdfe75c5d7a0..e17d925d2e26de59a4343d59e2db54538a2e0afd 100644 (file)
@@ -198,7 +198,11 @@ class CronjobScheduler extends SingletonFactory {
         */
        protected function loadCache() {
                $cacheName = 'cronjobs-'.PACKAGE_ID;
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderCronjob');
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\CronjobCacheBuilder'
+               );
                $this->cache = CacheHandler::getInstance()->get($cacheName);
        }
        
index 4efb9d529ae9355919ab9b8bb750a9550ad0317c..4a645f26b30653f02891513291319a7870ca5c93 100644 (file)
@@ -55,13 +55,28 @@ class EventHandler extends SingletonFactory {
         * Loads all registered actions of the active package.
         */
        protected function loadActions() {
-               CacheHandler::getInstance()->addResource('eventListener-'.PACKAGE_ID, WCF_DIR.'cache/cache.eventListener-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderEventListener');
-               $cache = CacheHandler::getInstance()->get('eventListener-'.PACKAGE_ID);
-               if (isset($cache['actions'])) $this->actions = $cache['actions'];
-               if (isset($cache['inheritedActions'])) $this->inheritedActions = $cache['inheritedActions'];
+               $cacheName = 'eventListener-'.PACKAGE_ID;
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\EventListenerCacheBuilder'
+               );
+               $cache = CacheHandler::getInstance()->get($cacheName);
+               
+               if (isset($cache['actions'])) {
+                       $this->actions = $cache['actions'];
+               }
+               if (isset($cache['inheritedActions'])) {
+                       $this->inheritedActions = $cache['inheritedActions'];
+               }
                unset($cache);
-               if (!is_array($this->actions)) $this->actions = array();
-               if (!is_array($this->inheritedActions)) $this->inheritedActions = array();
+               
+               if (!is_array($this->actions)) {
+                       $this->actions = array();
+               }
+               if (!is_array($this->inheritedActions)) {
+                       $this->inheritedActions = array();
+               }
        }
        
        /**
index d464e6ad286f93f993324b184478a43ce1a9816e..de8672cbe3f941578cafcd86fdc2a925b6c35181 100644 (file)
@@ -211,7 +211,7 @@ abstract class LanguageFactory {
                        CacheHandler::getInstance()->addResource(
                                'languages',
                                WCF_DIR.'cache/cache.languages.php',
-                               'wcf\system\cache\builder\CacheBuilderLanguage'
+                               'wcf\system\cache\builder\LanguageCacheBuilder'
                        );
                        
                        self::$cache = CacheHandler::getInstance()->get('languages');
index 583e0031532ca76b42ef18ae8573deb7cd354266..34eb9aa6caadef7c3241dca79839a1510e2a0295 100644 (file)
@@ -24,7 +24,12 @@ class ACPMenu extends TreeMenu {
                        return;
                }
                
-               CacheHandler::getInstance()->addResource('menu-'.PACKAGE_ID, WCF_DIR.'cache/cache.menu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderACPMenu');
-               $this->menuItems = CacheHandler::getInstance()->get('menu-'.PACKAGE_ID);
+               $cacheName = 'acpMenu-'.PACKAGE_ID;
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\ACPMenuCacheBuilder'
+               );
+               $this->menuItems = CacheHandler::getInstance()->get($cacheName);
        }
 }
index ba39bf142ccd8a7c9781099e27375c1c0b537144..9142c946ba777402f361c028079c23a7e931b8a7 100644 (file)
@@ -23,8 +23,13 @@ class PageMenu extends TreeMenu {
                parent::loadCache();
                
                // get cache
-               CacheHandler::getInstance()->addResource('pageMenu-'.PACKAGE_ID, WCF_DIR.'cache/cache.pageMenu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderPageMenu');
-               $this->menuItems = CacheHandler::getInstance()->get('pageMenu-'.PACKAGE_ID);
+               $cacheName = 'pageMenu-'.PACKAGE_ID;
+               CacheHandler::getInstance()->addResource(
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\CacheBuilderPageMenu'
+               );
+               $this->menuItems = CacheHandler::getInstance()->get($cacheName);
        }
        
        /**
index 2c1dec1af7d3763563310d2b4afeadc176725851..3437bd60e1d6567b83951bf18823730cf013f0c4 100644 (file)
@@ -69,12 +69,13 @@ abstract class PackageDependencyHandler {
         * Reads package dependency cache.
         */     
        protected static function readCache() {
+               $cacheName = 'packageDependencies-'.PACKAGE_ID;
                CacheHandler::getInstance()->addResource(
-                       'packageDependencies-'.PACKAGE_ID,
-                       WCF_DIR.'cache/cache.packageDependencies-'.PACKAGE_ID.'.php',
-                       'wcf\system\cache\builder\CacheBuilderPackageDependency'
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\PackageDependencyCacheBuilder'
                );
                
-               self::$packageDependencyCache = CacheHandler::getInstance()->get('packageDependencies-'.PACKAGE_ID);
+               self::$packageDependencyCache = CacheHandler::getInstance()->get($cacheName);
        }
 }
index 5c3d9d9387305ef823bcf1cf2d9aeb1feb571497..92feaead7da0d649c17bbabebef79b5d296abf14 100644 (file)
@@ -436,14 +436,15 @@ class SessionHandler extends SingletonFactory {
                $groupsFileName = StringUtil::getHash($groups);
                
                // register cache resource
+               $cacheName = 'groups-'.PACKAGE_ID.'-'.$groups;
                CacheHandler::getInstance()->addResource(
-                       'groups-'.PACKAGE_ID.'-'.$groups,
-                       WCF_DIR.'cache/cache.groups-'.PACKAGE_ID.'-'.$groupsFileName.'.php',
-                       'wcf\system\cache\builder\CacheBuilderUserGroupPermission'
+                       $cacheName,
+                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
+                       'wcf\system\cache\builder\UserGroupPermissionCacheBuilder'
                );
                
                // get group data from cache
-               $this->groupData = CacheHandler::getInstance()->get('groups-'.PACKAGE_ID.'-'.$groups);
+               $this->groupData = CacheHandler::getInstance()->get($cacheName);
                if (isset($this->groupData['groupIDs']) && $this->groupData['groupIDs'] != $groups) {
                        $this->groupData = array();
                }
index c87ea632afc1a3e65d1bdf34d6b6925b8873d084..c6178e17c3edc966e05f06629edd8c8581febab5 100644 (file)
@@ -34,7 +34,11 @@ class StyleHandler extends SingletonFactory {
         */
        protected function init() {
                // load cache
-               CacheHandler::getInstance()->addResource('styles', WCF_DIR.'cache/cache.styles.php', 'wcf\system\cache\builder\CacheBuilderStyle');
+               CacheHandler::getInstance()->addResource(
+                       'styles',
+                       WCF_DIR.'cache/cache.styles.php',
+                       'wcf\system\cache\builder\StyleCacheBuilder'
+               );
                $this->cache = CacheHandler::getInstance()->get('styles');
        }
        
index 3f55efde4eaab7d9fd74af9cfb3be28de5a4976a..5b39cd6df1c7bcdf58621aaddd1a78f4b61e9b66 100644 (file)
@@ -624,7 +624,11 @@ class TemplateEngine extends SingletonFactory {
         * Loads cached template group information.
         */
        protected function loadTemplateGroupCache() {
-               CacheHandler::getInstance()->addResource('templateGroups', WCF_DIR.'cache/cache.templateGroups.php', 'wcf\system\cache\builder\CacheBuilderTemplateGroup');
+               CacheHandler::getInstance()->addResource(
+                       'templateGroups',
+                       WCF_DIR.'cache/cache.templateGroups.php',
+                       'wcf\system\cache\builder\TemplateGroupCacheBuilder'
+               );
                $this->templateGroupCache = CacheHandler::getInstance()->get('templateGroups');
        }
        
@@ -701,7 +705,7 @@ class TemplateEngine extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        $cacheName,
                        WCF_DIR.'cache/cache.'.$cacheName.'.php',
-                       'wcf\system\cache\builder\CacheBuilderTemplateListener'
+                       'wcf\system\cache\builder\TemplateListenerCacheBuilder'
                );
                
                $this->templateListeners = CacheHandler::getInstance()->get($cacheName);
@@ -734,7 +738,7 @@ class TemplateEngine extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        $cacheName,
                        WCF_DIR.'cache/templateListener/'.$cacheName.'.php',
-                       'wcf\system\cache\builder\CacheBuilderTemplateListenerCode'
+                       'wcf\system\cache\builder\TemplateListenerCodeCacheBuilder'
                );
                
                $this->templateListeners[$templateName] = CacheHandler::getInstance()->get($cacheName);