Major overhaul of caching system (work in progress)
authorAlexander Ebert <ebert@woltlab.com>
Mon, 4 Feb 2013 14:45:47 +0000 (15:45 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 4 Feb 2013 14:45:47 +0000 (15:45 +0100)
See #1124

59 files changed:
wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php
wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php
wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php
wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php
wcfsetup/install/files/lib/acp/page/UserListPage.class.php
wcfsetup/install/files/lib/data/application/ApplicationEditor.class.php
wcfsetup/install/files/lib/data/category/CategoryEditor.class.php
wcfsetup/install/files/lib/data/cleanup/listener/CleanupListener.class.php [deleted file]
wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerAction.class.php [deleted file]
wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerEditor.class.php [deleted file]
wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerList.class.php [deleted file]
wcfsetup/install/files/lib/data/cronjob/CronjobEditor.class.php
wcfsetup/install/files/lib/data/language/LanguageEditor.class.php
wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php
wcfsetup/install/files/lib/data/option/OptionEditor.class.php
wcfsetup/install/files/lib/data/package/PackageCache.class.php
wcfsetup/install/files/lib/data/package/PackageEditor.class.php
wcfsetup/install/files/lib/data/page/menu/item/PageMenuItemEditor.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/data/user/User.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php
wcfsetup/install/files/lib/data/user/group/UserGroupEditor.class.php
wcfsetup/install/files/lib/data/user/group/option/UserGroupOptionEditor.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/WCFACP.class.php
wcfsetup/install/files/lib/system/WCFSetup.class.php
wcfsetup/install/files/lib/system/acl/ACLHandler.class.php
wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php
wcfsetup/install/files/lib/system/cache/CacheHandler.class.php
wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php
wcfsetup/install/files/lib/system/category/CategoryHandler.class.php
wcfsetup/install/files/lib/system/category/CategoryPermissionHandler.class.php
wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php [deleted file]
wcfsetup/install/files/lib/system/cleanup/ICleanupAdapter.class.php [deleted file]
wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php
wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php
wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.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/option/OptionHandler.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/plugin/ACPSearchProviderPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/CoreObjectPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/SitemapPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php
wcfsetup/install/files/lib/system/session/SessionHandler.class.php
wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php
wcfsetup/install/files/lib/system/style/StyleHandler.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/version/VersionHandler.class.php
wcfsetup/setup/db/install.sql

index 273d756c3fef32687dd276e45890a4ad0a890362..05e592918170e36d036ee859f8d3821159baa008 100644 (file)
@@ -2,19 +2,17 @@
 namespace wcf\acp\action;
 use wcf\action\AbstractAction;
 use wcf\system\cache\CacheHandler;
-use wcf\system\exception\SystemException;
 use wcf\system\language\LanguageFactory;
 use wcf\system\request\LinkHandler;
 use wcf\system\style\StyleHandler;
 use wcf\system\WCF;
-use wcf\util\FileUtil;
 use wcf\util\HeaderUtil;
 
 /**
  * Clears the cache.
  * 
- * @author     Tim Düsterhus
- * @copyright  2012 Tim Düsterhus
+ * @author     Tim Duesterhus
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage acp.action
@@ -39,18 +37,7 @@ class CacheClearAction extends AbstractAction {
                LanguageFactory::getInstance()->deleteLanguageCache();
                
                // get package dirs
-               $sql = "SELECT  packageDir
-                       FROM    wcf".WCF_N."_package
-                       WHERE   isApplication = ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array(1));
-               while ($row = $statement->fetchArray()) {
-                       $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
-                       try {
-                               CacheHandler::getInstance()->clear($packageDir.'cache', '*.php');
-                       }
-                       catch (SystemException $e) { }
-               }
+               CacheHandler::getInstance()->flushAll();
                
                $this->executed();
                HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList'));
index dde534ad5df4a74f4d23d8ff1408d1277675eb13..ad7b32c8c3272a165f62281323dea709d9513dcf 100755 (executable)
@@ -6,14 +6,13 @@ use wcf\system\cache\CacheHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\package\PackageInstallationDispatcher;
 use wcf\system\WCF;
-use wcf\util\FileUtil;
 use wcf\util\StringUtil;
 
 /**
  * Handles an AJAX-based package installation.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage acp.action
@@ -224,17 +223,6 @@ class InstallPackageAction extends AbstractDialogAction {
         * Clears resources after successful installation.
         */
        protected function finalize() {
-               // clear cache
-               $sql = "SELECT  packageDir
-                       FROM    wcf".WCF_N."_package
-                       WHERE   isApplication = 1";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute();
-               
-               while ($row = $statement->fetchArray()) {
-                       $cacheDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir'] . 'cache/');
-                       
-                       CacheHandler::getInstance()->clear($cacheDir, '*.php');
-               }
+               CacheHandler::getInstance()->flushAll();
        }
 }
index 64190dd6357d891c06c21177c9457c9e1bafb9c9..dee75cf445ef432d289e7fa6f992f35d60ace04b 100755 (executable)
@@ -24,12 +24,6 @@ abstract class AbstractOptionListForm extends AbstractForm {
         */
        public $errorType = array();
        
-       /**
-        * cache name
-        * @var string
-        */
-       public $cacheName = 'option';
-       
        /**
         * cache class name
         * @var string
@@ -72,7 +66,7 @@ abstract class AbstractOptionListForm extends AbstractForm {
        public function readParameters() {
                parent::readParameters();
                
-               $this->optionHandler = new $this->optionHandlerClassName($this->cacheName, $this->cacheClass, $this->supportI18n, $this->languageItemPattern, $this->categoryName);
+               $this->optionHandler = new $this->optionHandlerClassName($this->cacheClass, $this->supportI18n, $this->languageItemPattern, $this->categoryName);
                $this->initOptionHandler();
        }
        
index 1ee730f6075f7d201e8b33562703a5c606322028..78af10098c701d91d21f0e94ea7fed1fc8342c8a 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\acp\form;
 use wcf\data\language\LanguageEditor;
 use wcf\form\AbstractForm;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\LanguageCacheBuilder;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\LanguageFactory;
 use wcf\system\WCF;
@@ -92,7 +92,7 @@ class LanguageMultilingualismForm extends AbstractForm {
                LanguageEditor::enableMultilingualism(($this->enable == 1 ? $this->languageIDs : array()));
                
                // clear cache
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+               LanguageCacheBuilder::getInstance()->reset();
                $this->saved();
                
                // show success message
index d101e978cd9fcffa5a3e72001fe755605bbecbf1..22b37a2157d07ff071a644c75daf1f2d17b4a364 100755 (executable)
@@ -31,11 +31,6 @@ class UserGroupAddForm extends AbstractOptionListForm {
         */
        public $menuItemName = 'wcf.acp.menu.link.group.add';
        
-       /**
-        * @see wcf\acp\form\AbstractOptionListForm::$cacheName
-        */
-       public $cacheName = 'userGroupOption';
-       
        /**
         * option tree
         * @var array
index 68306ae337fa72f005e5efc3522b216812dcd4f6..d7cc1c9a9c56c218e7b4fd6ef6b192f598bcffdc 100644 (file)
@@ -14,11 +14,6 @@ use wcf\system\language\LanguageFactory;
  * @category   Community Framework
  */
 abstract class UserOptionListForm extends AbstractOptionListForm {
-       /**
-        * @see wcf\acp\form\AbstractOptionListForm::$cacheName
-        */
-       public $cacheName = 'userOption';
-       
        /**
         * @see wcf\acp\form\AbstractOptionListForm::$supportI18n
         */
index 9fadcb72e1c3e4c084d77f59a9b4f0dd3f9c10dc..456a8299ba046af5ea8122b29dd21515dcfcea09 100755 (executable)
@@ -4,7 +4,7 @@ use wcf\data\user\group\UserGroup;
 use wcf\data\user\option\ViewableUserOption;
 use wcf\data\user\User;
 use wcf\page\SortablePage;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserOptionCacheBuilder;
 use wcf\system\clipboard\ClipboardHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\event\EventHandler;
@@ -18,7 +18,7 @@ use wcf\util\StringUtil;
  * Shows the result of a user search.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage acp.page
@@ -312,12 +312,7 @@ class UserListPage extends SortablePage {
         * Gets the user options from cache.
         */
        protected function readUserOptions() {
-               CacheHandler::getInstance()->addResource(
-                       'userOption',
-                       WCF_DIR.'cache/cache.userOption.php',
-                       'wcf\system\cache\builder\OptionCacheBuilder'
-               );
-               $this->options = CacheHandler::getInstance()->get('userOption', 'options');
+               $this->options = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
                
                foreach ($this->options as &$option) {
                        $option = new ViewableUserOption($option);
index 17934d25030ee40aaec1015850b9b014199b199f..a30d7a56331a87fa6264300781e983b1f413d17c 100644 (file)
@@ -2,14 +2,14 @@
 namespace wcf\data\application;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ApplicationCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Provides functions to edit applications.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.application
@@ -88,6 +88,6 @@ class ApplicationEditor extends DatabaseObjectEditor implements IEditableCachedO
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.application.php');
+               ApplicationCacheBuilder::getInstance()->reset();
        }
 }
index ccd4304169c8840dabc459cc5fdb8f57936bae0d..7abafb7595fcd4c2fa1d354629104f210fde583b 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\data\category;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CategoryCacheBuilder;
 use wcf\system\category\CategoryHandler;
 use wcf\system\WCF;
 
@@ -10,7 +10,7 @@ use wcf\system\WCF;
  * Provides functions to edit categories.
  * 
  * @author     Matthias Schmidt
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.category
@@ -213,6 +213,6 @@ class CategoryEditor extends DatabaseObjectEditor implements IEditableCachedObje
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.category.php');
+               CategoryCacheBuilder::getInstance()->reset();
        }
 }
diff --git a/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListener.class.php b/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListener.class.php
deleted file mode 100644 (file)
index b5cb6db..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-namespace wcf\data\cleanup\listener;
-use wcf\data\DatabaseObject;
-
-/**
- * Represents a cleanup listener.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.cleanup.listener
- * @category   Community Framework
- */
-class CleanupListener extends DatabaseObject {
-       /**
-        * @see wcf\data\DatabaseObject::$databaseTableName
-        */
-       protected static $databaseTableName = 'cleanup_listener';
-       
-       /**
-        * @see wcf\data\DatabaseObject::$databaseTableIndexName
-        */
-       protected static $databaseTableIndexName = 'listenerID';
-}
diff --git a/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerAction.class.php b/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerAction.class.php
deleted file mode 100644 (file)
index 731aff1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\cleanup\listener;
-use wcf\data\AbstractDatabaseObjectAction;
-
-/**
- * Executes cleanup listener-related actions.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.cleanup.listener
- * @category   Community Framework
- */
-class CleanupListenerAction extends AbstractDatabaseObjectAction {
-       /**
-        * @see wcf\data\AbstractDatabaseObjectAction::$className
-        */
-       protected $className = 'wcf\data\cleanup\listener\CleanupListenerEditor';
-}
diff --git a/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerEditor.class.php b/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerEditor.class.php
deleted file mode 100644 (file)
index ccd9669..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\cleanup\listener;
-use wcf\data\DatabaseObjectEditor;
-
-/**
- * Provides functions to edit cleanup listeners.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.cleanup.listener
- * @category   Community Framework
- */
-class CleanupListenerEditor extends DatabaseObjectEditor {
-       /**
-        * @see wcf\data\DatabaseObjectDecorator::$baseClass
-        */
-       public $baseClass = 'wcf\data\cleanup\listener\CleanupListener';
-}
diff --git a/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerList.class.php b/wcfsetup/install/files/lib/data/cleanup/listener/CleanupListenerList.class.php
deleted file mode 100644 (file)
index fddd31f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\cleanup\listener;
-use wcf\data\DatabaseObjectList;
-
-/**
- * Represents a list of cleanup listener.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.cleanup.listener
- * @category   Community Framework
- */
-class CleanupListenerList extends DatabaseObjectList {
-       /**
-        * @see wcf\data\DatabaseObjectList::$className
-        */
-       public $className = 'wcf\data\cleanup\listener\CleanupListener';
-}
index dc215363d0389cbe3fb2ec28fcec284a387250c8..d04bdc02d8bf09e58eb8f9e43f6161a9451f4010 100644 (file)
@@ -3,7 +3,7 @@ namespace wcf\data\cronjob;
 use wcf\data\language\LanguageList;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CronjobCacheBuilder;
 use wcf\system\language\LanguageFactory;
 use wcf\system\WCF;
 
@@ -11,7 +11,7 @@ use wcf\system\WCF;
  * Provides functions to edit cronjobs.
  * 
  * @author     Alexander Ebert, Matthias Schmidt
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.cronjob
@@ -110,6 +110,6 @@ class CronjobEditor extends DatabaseObjectEditor implements IEditableCachedObjec
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.cronjob.php');
+               CronjobCacheBuilder::getInstance()->reset();
        }
 }
index 0b569cca5545d591b3f90cf3b6ff9b003b67f300..204b3d389c7c23dc948bd04d493bf32458b67edb 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\language\item\LanguageItemEditor;
 use wcf\data\language\item\LanguageItemList;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\LanguageCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\io\File;
@@ -21,7 +21,7 @@ use wcf\util\XML;
  * Provides functions to edit languages.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.language
@@ -507,7 +507,7 @@ class LanguageEditor extends DatabaseObjectEditor implements IEditableCachedObje
         * Clears language cache.
         */
        public function clearCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+               LanguageCacheBuilder::getInstance()->reset();
        }
        
        /**
index 2b9626a600039881da722b2c722fb95a14c5375b..45d4317d775f4960190836f050cf3bb23daaf1f3 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\data\object\type;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ObjectTypeCacheBuilder;
 use wcf\system\SingletonFactory;
 
 /**
  * Manages the object type cache.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.object.type
@@ -49,19 +49,14 @@ class ObjectTypeCache extends SingletonFactory {
         */
        protected function init() {
                // get definition cache
-               CacheHandler::getInstance()->addResource(
-                       'objectType',
-                       WCF_DIR.'cache/cache.objectType.php',
-                       'wcf\system\cache\builder\ObjectTypeCacheBuilder'
-               );
-               $this->definitionsByCategory = CacheHandler::getInstance()->get('objectType', 'categories');
-               $this->definitions = CacheHandler::getInstance()->get('objectType', 'definitions');
+               $this->definitionsByCategory = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'categories');
+               $this->definitions = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'definitions');
                foreach ($this->definitions as $definition) {
                        $this->definitionsByName[$definition->definitionName] = $definition;
                }
                
                // get object type cache
-               $this->objectTypes = CacheHandler::getInstance()->get('objectType', 'objectTypes');
+               $this->objectTypes = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'objectTypes');
                foreach ($this->objectTypes as $objectType) {
                        $definition = $this->getDefinition($objectType->definitionID);
                        if (!isset($this->groupedObjectTypes[$definition->definitionName])) {
@@ -171,7 +166,7 @@ class ObjectTypeCache extends SingletonFactory {
         * Resets and reloads the object type cache.
         */
        public function resetCache() {
-               CacheHandler::getInstance()->clearResource('objectType');
+               ObjectTypeCacheBuilder::getInstance()->reset();
                $this->init();
        }
 }
index 23554332680ecfdd6ba7a981ad75c493a93a30e2..073704b4b83b08edac7a0f003ac7937cdde8340a 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\data\option;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\OptionCacheBuilder;
 use wcf\system\io\File;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
@@ -11,7 +11,7 @@ use wcf\util\FileUtil;
  * Provides functions to edit options.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.option
@@ -82,7 +82,7 @@ class OptionEditor extends DatabaseObjectEditor implements IEditableCachedObject
         */
        public static function resetCache() {
                // reset cache
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.option.php');
+               OptionCacheBuilder::getInstance()->reset();
                
                // reset options.inc.php files
                self::rebuild();
index 0b86f76a5ec57dc115b36e7434252a48d17cc46b..61073a54cdc4cf8654dffb8f672ab8a19f5a4de0 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\data\package;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\PackageCacheBuilder;
 use wcf\system\SingletonFactory;
 
 /**
  * Manages the package cache.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.package
@@ -24,12 +24,7 @@ class PackageCache extends SingletonFactory {
         * @see wcf\system\SingletonFactory::init()
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'package',
-                       WCF_DIR.'cache/cache.package.php',
-                       'wcf\system\cache\builder\PackageCacheBuilder'
-               );
-               $this->packages = CacheHandler::getInstance()->get('package');
+               $this->packages = PackageCacheBuilder::getInstance()->getData();
        }
        
        /**
index b1e2f09b832676db349e11609474a50f9b5416df..c5e1bf46a73ef38184aa034e9fb7616d39dbbd61 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\data\package;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\PackageCacheBuilder;
 
 /**
  * Provides functions to edit packages.
@@ -24,6 +24,6 @@ class PackageEditor extends DatabaseObjectEditor implements IEditableCachedObjec
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.package.php');
+               PackageCacheBuilder::getInstance()->reset();
        }
 }
index c632a92ffbb5afbdb29bdce2999410237ac48b21..3dbfc01ae910573f69258f02ad4378c2d59c5ca2 100644 (file)
@@ -2,14 +2,14 @@
 namespace wcf\data\page\menu\item;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\PageMenuCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Provides functions to edit page menu items.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.page.menu.item
@@ -152,6 +152,6 @@ class PageMenuItemEditor extends DatabaseObjectEditor implements IEditableCached
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.pageMenu.php');
+               PageMenuCacheBuilder::getInstance()->reset();
        }
 }
index 44f8f8b4008b34cd57b288ce5af281ec88826f90..bd2018f9b56f84a316cb5801c27eb48b0f57e8b0 100644 (file)
@@ -7,7 +7,7 @@ use wcf\data\template\group\TemplateGroupEditor;
 use wcf\data\template\TemplateEditor;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\StyleCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\image\ImageHandler;
 use wcf\system\io\Tar;
@@ -27,7 +27,7 @@ use wcf\util\XMLWriter;
  * Provides functions to edit, import, export and delete a style.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.style
@@ -935,7 +935,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.style.php');
+               StyleCacheBuilder::getInstance()->reset();
        }
        
        /**
index 233a99d559bf281cd07d69b1a7f9126a336617a3..4c586e4e8c122e527d6731786d01360a9468d218 100644 (file)
@@ -4,7 +4,7 @@ use wcf\data\user\group\UserGroup;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObject;
 use wcf\system\api\rest\response\IRESTfulResponse;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserOptionCacheBuilder;
 use wcf\system\language\LanguageFactory;
 use wcf\system\request\IRouteController;
 use wcf\system\user\storage\UserStorageHandler;
@@ -15,7 +15,7 @@ use wcf\util\PasswordUtil;
  * Represents a user.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user
@@ -241,12 +241,7 @@ final class User extends DatabaseObject implements IRESTfulResponse, IRouteContr
         * Gets all user options from cache.
         */
        protected static function getUserOptionCache() {
-               CacheHandler::getInstance()->addResource(
-                       'userOption',
-                       WCF_DIR.'cache/cache.userOption.php',
-                       'wcf\system\cache\builder\OptionCacheBuilder'
-               );
-               self::$userOptions = CacheHandler::getInstance()->get('userOption', 'options');
+               self::$userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options');
        }
        
        /**
index 4f201da395fc408d0e18befe416b11e563b05b1e..d5ed25616baab5b3f85fdb8c2401ec0d090e5830 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\data\user\group;
 use wcf\data\user\User;
 use wcf\data\DatabaseObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserGroupCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\WCF;
@@ -11,7 +11,7 @@ use wcf\system\WCF;
  * Represents a user group.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user.group
@@ -219,12 +219,7 @@ class UserGroup extends DatabaseObject {
         */
        protected static function getCache() {
                if (self::$cache === null) {
-                       CacheHandler::getInstance()->addResource(
-                               'userGroup',
-                               WCF_DIR.'cache/cache.userGroup.php',
-                               'wcf\system\cache\builder\UserGroupCacheBuilder'
-                       );
-                       self::$cache = CacheHandler::getInstance()->get('userGroup');
+                       self::$cache = UserGroupCacheBuilder::getInstance()->getData();
                }
        }
        
index fe2ccec302ed65e6cf556ebbb442d62e72de724e..572366be9678b28bfc876ad76f3a103856ff3461 100644 (file)
@@ -2,7 +2,8 @@
 namespace wcf\data\user\group;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserGroupCacheBuilder;
+use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\session\SessionHandler;
 use wcf\system\WCF;
@@ -11,7 +12,7 @@ use wcf\system\WCF;
  * Provides functions to edit user groups.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user.group
@@ -179,7 +180,8 @@ class UserGroupEditor extends DatabaseObjectEditor implements IEditableCachedObj
         */
        public static function resetCache() {
                // clear cache
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroup*');
+               UserGroupCacheBuilder::getInstance()->reset();
+               UserGroupPermissionCacheBuilder::getInstance()->reset();
                
                // clear sessions
                SessionHandler::resetSessions();
index 736994042d0581144940977a281de644e750d283..c4a3f96221cb408f6d4caf0d8eacb1f9f7175751 100644 (file)
@@ -2,13 +2,13 @@
 namespace wcf\data\user\group\option;
 use wcf\data\DatabaseObjectEditor;
 use wcf\data\IEditableCachedObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserGroupOptionCacheBuilder;
 
 /**
  * Provides functions to edit usergroup options.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.user.group.option
@@ -24,6 +24,6 @@ class UserGroupOptionEditor extends DatabaseObjectEditor implements IEditableCac
         * @see wcf\data\IEditableCachedObject::resetCache()
         */
        public static function resetCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroup*.php');
+               UserGroupOptionCacheBuilder::getInstance()->reset();
        }
 }
index 03514eab69bf38514ced8dc6e81b47aeb629e4ab..deb265696a7fae93e511c371567727ec8ac2afd5 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\package\Package;
 use wcf\data\package\PackageCache;
 use wcf\data\package\PackageEditor;
 use wcf\system\application\ApplicationHandler;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CoreObjectCacheBuilder;
 use wcf\system\cronjob\CronjobScheduler;
 use wcf\system\exception\IPrintableException;
 use wcf\system\exception\PermissionDeniedException;
@@ -300,24 +300,7 @@ class WCF {
         * Loads the default cache resources.
         */
        protected function loadDefaultCacheResources() {
-               CacheHandler::getInstance()->addResource(
-                       'language',
-                       WCF_DIR.'cache/cache.language.php',
-                       'wcf\system\cache\builder\LanguageCacheBuilder'
-               );
-               CacheHandler::getInstance()->addResource(
-                       'spider',
-                       WCF_DIR.'cache/cache.spider.php',
-                       'wcf\system\cache\builder\SpiderCacheBuilder'
-               );
-               
-               if (defined('PACKAGE_ID')) {
-                       CacheHandler::getInstance()->addResource(
-                               'coreObject',
-                               WCF_DIR.'cache/cache.coreObject.php',
-                               'wcf\system\cache\builder\CoreObjectCacheBuilder'
-                       );
-               }
+               // TODO: Is this required anymore?
        }
        
        /**
@@ -520,7 +503,7 @@ class WCF {
                        return;
                }
                
-               self::$coreObjectCache = CacheHandler::getInstance()->get('coreObject');
+               self::$coreObjectCache = CoreObjectCacheBuilder::getInstance()->getData();
        }
        
        /**
index a9a0f7c08194d5bee97d7538183b0e9abf75b70c..9abc708d46de09b713af0ad2f436e8bdfe726ca0 100644 (file)
@@ -3,7 +3,7 @@ namespace wcf\system;
 use wcf\acp\form\MasterPasswordForm;
 use wcf\acp\form\MasterPasswordInitForm;
 use wcf\system\application\ApplicationHandler;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\PackageCacheBuilder;
 use wcf\system\exception\AJAXException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\request\RouteHandler;
@@ -130,11 +130,7 @@ class WCFACP extends WCF {
        protected function loadDefaultCacheResources() {
                parent::loadDefaultCacheResources();
                
-               CacheHandler::getInstance()->addResource(
-                       'package',
-                       WCF_DIR.'cache/cache.package.php',
-                       'wcf\system\cache\builder\PackageCacheBuilder'
-               );
+               // TODO: Is this required anymore?
        }
        
        /**
@@ -154,8 +150,7 @@ class WCFACP extends WCF {
         */
        protected function getQuickAccessPackages() {
                $quickAccessPackages = array();
-               $packages = CacheHandler::getInstance()->get('package');
-               foreach ($packages['packages'] as $packageID => $package) {
+               foreach (PackageCacheBuilder::getInstance()->getData(array(), 'packages') as $packageID => $package) {
                        if (!$package->isApplication) break;
                        if ($package->package != 'com.woltlab.wcf') {
                                $quickAccessPackages[] = $package;
index 6b0c2ee0a28a1f9950b81144627cce425af01fce..1d797d5833117a4636b1294bdf523fd62750b580 100644 (file)
@@ -5,7 +5,7 @@ use wcf\data\language\SetupLanguage;
 use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
 use wcf\data\user\User;
 use wcf\data\user\UserAction;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\LanguageCacheBuilder;
 use wcf\system\database\util\SQLParser;
 use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
@@ -864,7 +864,7 @@ class WCFSetup extends WCF {
                LanguageFactory::getInstance()->makeDefault($language->languageID);
                
                // rebuild language cache
-               CacheHandler::getInstance()->clearResource('language');
+               LanguageCacheBuilder::getInstance()->reset();
                
                // go to next step
                $this->gotoNextStep('createUser');
index 87ea4e5c93d09608464653923946bc841e97d3b5..2f8b43a219be39d247edea39bb74c86a8939bef4 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\acl\option\ACLOption;
 use wcf\data\acl\option\ACLOptionList;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\user\User;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ACLOptionCategoryCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
@@ -16,7 +16,7 @@ use wcf\system\WCF;
  * Handles ACL permissions.
  *
  * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.acl
@@ -116,13 +116,7 @@ class ACLHandler extends SingletonFactory {
         */
        protected function init() {
                $this->availableObjectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.acl');
-               
-               CacheHandler::getInstance()->addResource(
-                       'aclOptionCategory',
-                       WCF_DIR.'cache/cache.aclOptionCategory.php',
-                       'wcf\system\cache\builder\ACLOptionCategoryCacheBuilder'
-               );              
-               $this->categories = CacheHandler::getInstance()->get('aclOptionCategory');
+               $this->categories = ACLOptionCategoryCacheBuilder::getInstance()->getData();
        }
        
        /**
index 38ba52116342154ab1b3162dbad5a4b072ae01bc..3816dee286b5543aaead6281fdd8a526c363dd18 100644 (file)
@@ -3,14 +3,14 @@ namespace wcf\system\application;
 use wcf\data\application\ApplicationAction;
 use wcf\data\application\ApplicationEditor;
 use wcf\data\application\ApplicationList;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ApplicationCacheBuilder;
 use wcf\system\SingletonFactory;
 
 /**
  * Handles multi-application environments.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.application
@@ -33,12 +33,7 @@ class ApplicationHandler extends SingletonFactory {
         * Initializes cache.
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'application',
-                       WCF_DIR.'cache/cache.application.php',
-                       'wcf\system\cache\builder\ApplicationCacheBuilder'
-               );
-               $this->cache = CacheHandler::getInstance()->get('application');
+               $this->cache = ApplicationCacheBuilder::getInstance()->getData();
        }
        
        /**
index 9ab1be24bc26247141e4eae4afc7d740b73b0ef6..9b9ebf5c2590bc9a11d7de8b9aee9f96771de2b1 100644 (file)
@@ -44,7 +44,7 @@ class CacheHandler extends SingletonFactory {
        }
        
        /**
-        * Flushed cache for given resource.
+        * Flush cache for given resource.
         * 
         * @param       wcf\system\cache\builder\ICacheBuilder          $cacheBuilder
         * @param       array                                           $parameters
@@ -54,6 +54,13 @@ class CacheHandler extends SingletonFactory {
                $this->getCacheSource()->flush($this->getCacheName($cacheBuilder), $useWildCard);
        }
        
+       /**
+        * Flushes the entire cache.
+        */
+       public function flushAll() {
+               $this->getCacheSource()->flushAll();
+       }
+       
        /**
         * Returns cached value for given resource, false if no cache exists.
         * 
index f90b7792d8f063e4084006a0da7a6ea5d4077ff5..9518ce0662478d21af14c0ed6eb246457631f23b 100644 (file)
@@ -3,7 +3,7 @@ namespace wcf\system\cache\builder;
 use wcf\data\template\listener\TemplateListenerList;
 
 /**
- * Caches the template listener code for a certain template in a certain environment.
+ * Caches the template listener code for a certain environment.
  * 
  * @author     Alexander Ebert
  * @copyright  2001-2013 WoltLab GmbH
@@ -20,12 +20,15 @@ class TemplateListenerCodeCacheBuilder extends AbstractCacheBuilder {
                // get template codes for specified template
                $templateListenerList = new TemplateListenerList();
                $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($parameters['environment']));
-               $templateListenerList->getConditionBuilder()->add("template_listener.templateName = ?", array($parameters['templateName']));
                $templateListenerList->readObjects();
                
                $data = array();
                foreach ($templateListenerList->getObjects() as $templateListener) {
-                       $data[$templateListener->eventName][] = $templateListener->templateCode;
+                       if (!isset($data[$templateListener->templateName])) {
+                               $data[$templateListener->templateName] = array();
+                       }
+                       
+                       $data[$templateListener->templateName][$templateListener->eventName][] = $templateListener->templateCode;
                }
                
                return $data;
index 4456a8b0846668e7344886bcda2516322b8e9912..6e76794a59cf5a00c653a76ff5a0b8bb4f068607 100644 (file)
@@ -4,7 +4,7 @@ use wcf\data\category\Category;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectDecorator;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CategoryCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 
@@ -12,7 +12,7 @@ use wcf\system\SingletonFactory;
  * Handles the categories.
  * 
  * @author     Matthias Schmidt
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.category
@@ -147,20 +147,15 @@ class CategoryHandler extends SingletonFactory {
                        $this->objectTypeIDs[$objectType->objectTypeID] = $objectType->objectType;
                }
                
-               CacheHandler::getInstance()->addResource(
-                       'category',
-                       WCF_DIR.'cache/cache.category.php',
-                       'wcf\system\cache\builder\CategoryCacheBuilder'
-               );
-               $this->categories = CacheHandler::getInstance()->get('category', 'categories');
-               $this->objectTypeCategoryIDs = CacheHandler::getInstance()->get('category', 'objectTypeCategoryIDs');
+               $this->categories = CategoryCacheBuilder::getInstance()->getData(array(), 'categories');
+               $this->objectTypeCategoryIDs = CategoryCacheBuilder::getInstance()->getData(array(), 'objectTypeCategoryIDs');
        }
        
        /**
         * Reloads the category cache.
         */
        public function reloadCache() {
-               CacheHandler::getInstance()->clearResource('category');
+               CategoryCacheBuilder::getInstance()->reset();
                
                $this->init();
        }
index 61e3b496a3a729eb1b1a5d7243398c0ca5acc5c4..64995c1f9ebefc3159a2638da8f3aa2de102376c 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\category;
 use wcf\data\category\Category;
 use wcf\data\user\User;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CategoryACLOptionCacheBuilder;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -10,7 +10,7 @@ use wcf\system\WCF;
  * Handles the category permissions.
  *
  * @author     Matthias Schmidt
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.category
@@ -66,18 +66,13 @@ class CategoryPermissionHandler extends SingletonFactory {
         * @see wcf\system\SingletonFactory::init()
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'categoryACLOption',
-                       WCF_DIR.'cache/cache.categoryACLOption.php',
-                       'wcf\system\cache\builder\CategoryACLOptionCacheBuilder'
-               );
-               $this->categoryPermissions = CacheHandler::getInstance()->get('categoryACLOption');
+               $this->categoryPermissions = CategoryACLOptionCacheBuilder::getInstance()->getData();
        }
        
        /**
         * Resets the category permission cache.
         */
        public function resetCache() {
-               CacheHandler::getInstance()->clearResource('categoryACLOption');
+               CategoryACLOptionCacheBuilder::getInstance()->reset();
        }
 }
diff --git a/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php b/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php
deleted file mode 100644 (file)
index fa1e86d..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-namespace wcf\system\cleanup;
-use wcf\system\cache\CacheHandler;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\event\EventHandler;
-use wcf\system\exception\SystemException;
-use wcf\system\WCF;
-use wcf\util\ArrayUtil;
-use wcf\util\ClassUtil;
-
-/**
- * Handles cleanup-related actions.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cleanup
- * @category   Community Framework
- */
-class CleanupHandler {
-       /**
-        * unique instance of CleanupHandler
-        * @var wcf\system\cleanup\CleanupHandler
-        */
-       protected static $instance = null;
-       
-       /**
-        * cleanup adapter cache
-        * @var array<array>
-        */
-       protected $cache = null;
-       
-       /**
-        * Initializes cleanup handler.
-        */
-       protected function __construct() {
-               $this->loadCache();
-       }
-       
-       /**
-        * Prevents creating an additional instance.
-        */
-       protected function __clone() {}
-       
-       /**
-        * Loads cleanup adapter cache.
-        */
-       protected function loadCache() {
-               CacheHandler::getInstance()->addResource(
-                       'cleanupAdapter',
-                       WCF_DIR.'cache/cache.cleanupAdapter.php',
-                       'wcf\system\cache\builder\CleanupAdapterCacheBuilder'
-               );
-               $this->cache = CacheHandler::getInstance()->get('cleanupAdapter');
-       }
-       
-       /**
-        * Prepares adapter execution
-        */
-       public function execute() {
-               // remove all logged items older than 24 hours
-               $sql = "DELETE FROM     wcf".WCF_N."_cleanup_log
-                       WHERE           deleteTime < ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array(
-                       (TIME_NOW - 86400)
-               ));
-               
-               // loop through all available adapters
-               foreach ($this->cache['adapters'] as $objectType => $adapters) {
-                       // determine if there are any items for current object type
-                       $conditions = new PreparedStatementConditionBuilder();
-                       $conditions->add("objectType = ?", array($objectType));
-                       $conditions->add("packageID IN (?)", array($this->cache['objectTypes'][$objectType]));
-                       
-                       $sql = "SELECT  objectID
-                               FROM    wcf".WCF_N."_cleanup_log
-                               ".$conditions;
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute($conditions->getParameters());
-                       
-                       $objectIDs = array();
-                       while ($row = $statement->fetchArray()) {
-                               $objectIDs[] = $row['objectID'];
-                       }
-                       
-                       if (!empty($objectIDs)) {
-                               $this->executeAdapters($adapters, $objectIDs);
-                       }
-               }
-       }
-       
-       /**
-        * Executes specific cleanup adapters.
-        * 
-        * @param       array           $adapters
-        * @param       array           $objectIDs
-        */
-       protected function executeAdapters(array $adapters, array $objectIDs) {
-               $sql = "UPDATE  wcf".WCF_N."_cleanup_listener
-                       SET     lastUpdateTime = ?
-                       WHERE   listenerID = ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               
-               foreach ($adapters as $adapterData) {
-                       // validate class
-                       if (!class_exists($adapterData['className'])) {
-                               throw new SystemException("unable to find class '".$adapterData['className']."'");
-                       }
-                       
-                       // validate interface
-                       if (!(ClassUtil::isInstanceOf($adapterData['className'], 'wcf\system\cleanup\ICleanupAdapter'))) {
-                               throw new SystemException("'".$adapterData['className']."' does not implement 'wcf\system\cleanup\ICleanupAdapter'");
-                       }
-                       
-                       $adapter = new $adapterData['className']();
-                       $adapter->execute($objectIDs);
-                       
-                       // update last time of execution
-                       $statement->execute(array(TIME_NOW, $adapterData['listenerID']));
-               }
-       }
-       
-       /**
-        * Returns an unique instance of CleanupHandler.
-        * 
-        * @return      wcf\system\cleanup\CleanupHandler
-        */
-       public static function getInstance() {
-               if (self::$instance === null) {
-                       // call loadInstance event
-                       EventHandler::getInstance()->fireAction(__CLASS__, 'loadInstance');
-                       
-                       if (self::$instance === null) {
-                               self::$instance = new CleanupHandler();
-                       }
-               }
-               
-               return self::$instance;
-       }
-       
-       /**
-        * Registers deleted objects.
-        * 
-        * @param       string          $objectType
-        * @param       array           $objectIDs
-        * @param       integer         $packageID
-        */
-       public static function registerObjects($objectType, array $objectIDs, $packageID) {
-               $objectIDs = ArrayUtil::toIntegerArray($objectIDs);
-               $packageID = intval($packageID);
-               
-               // insert items
-               $sql = "INSERT INTO     wcf".WCF_N."_cleanup_log
-                                       (packageID, objectType, objectID, deleteTime)
-                       VALUES          (?, ?, ?, ?)";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               
-               foreach ($objectIDs as $objectID) {
-                       $statement->execute(array(
-                               $packageID,
-                               $objectType,
-                               $objectID,
-                               TIME_NOW
-                       ));
-               }
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cleanup/ICleanupAdapter.class.php b/wcfsetup/install/files/lib/system/cleanup/ICleanupAdapter.class.php
deleted file mode 100644 (file)
index 8835043..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-namespace wcf\system\cleanup;
-
-/**
- * Default interface for cleanup adapters.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cleanup
- * @category   Community Framework
- */
-interface ICleanupAdapter {
-       /**
-        * Executes this adapter.
-        * 
-        * @param       array           $objectIDs
-        */
-       public function execute(array $objectIDs);
-}
index 436039444e51c272b7d3851423585fed12f68a7b..16ddee55540702c4e2e064e91615b31cba89d7d3 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 namespace wcf\system\clipboard;
 use wcf\data\object\type\ObjectTypeCache;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ClipboardActionCacheBuilder;
+use wcf\system\cache\builder\ClipboardPageCacheBuilder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
@@ -12,7 +13,7 @@ use wcf\util\ClassUtil;
  * Handles clipboard-related actions.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.clipboard
@@ -57,12 +58,7 @@ class ClipboardHandler extends SingletonFactory {
                        $this->cache['objectTypeNames'][$objectType->objectType] = $objectType->objectTypeID;
                }
                
-               CacheHandler::getInstance()->addResource(
-                       'clipboardPage',
-                       WCF_DIR.'cache/cache.clipboardPage.php',
-                       'wcf\system\cache\builder\ClipboardPageCacheBuilder'
-               );
-               $this->pageCache = CacheHandler::getInstance()->get('clipboardPage');
+               $this->pageCache = ClipboardPageCacheBuilder::getInstance()->getData();
        }
        
        /**
@@ -71,12 +67,7 @@ class ClipboardHandler extends SingletonFactory {
        protected function loadActionCache() {
                if ($this->actionCache !== null) return;
                
-               CacheHandler::getInstance()->addResource(
-                       'clipboardAction',
-                       WCF_DIR.'cache/cache.clipboardAction.php',
-                       'wcf\system\cache\builder\ClipboardActionCacheBuilder'
-               );
-               $this->actionCache = CacheHandler::getInstance()->get('clipboardAction');
+               $this->actionCache = ClipboardActionCacheBuilder::getInstance()->getData();
        }
        
        /**
index f7a8ba076797088c743130492438058c6d59b325..de6fb7466e1880389dbb835d0c32bd8a9d02d074 100644 (file)
@@ -3,7 +3,7 @@ namespace wcf\system\cronjob;
 use wcf\data\cronjob\log\CronjobLogEditor;
 use wcf\data\cronjob\Cronjob;
 use wcf\data\cronjob\CronjobEditor;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CronjobCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
@@ -13,7 +13,7 @@ use wcf\util\ClassUtil;
  * Provides functions to execute cronjobs.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.cronjob
@@ -204,18 +204,13 @@ class CronjobScheduler extends SingletonFactory {
         * Loads the cached data for cronjob execution.
         */
        protected function loadCache() {
-               CacheHandler::getInstance()->addResource(
-                       'cronjob',
-                       WCF_DIR.'cache/cache.cronjob.php',
-                       'wcf\system\cache\builder\CronjobCacheBuilder'
-               );
-               $this->cache = CacheHandler::getInstance()->get('cronjob');
+               $this->cache = CronjobCacheBuilder::getInstance()->getData();
        }
        
        /**
         * Clears the cronjob data cache.
         */
        public static function clearCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.cronjob.php');
+               CronjobCacheBuilder::getInstance()->reset();
        }
 }
index 0cf62140b72eb6cad332a76916ed8dc0ac31b063..9788f21af0db7149ded62325f7c54bbf662d1caa 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\cronjob;
 use wcf\data\cronjob\Cronjob;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\SpiderCacheBuilder;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
 use wcf\util\StringUtil;
@@ -11,7 +11,7 @@ use wcf\util\XML;
  * Refreshes list of search robots.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.cronjob
@@ -66,7 +66,7 @@ class RefreshSearchRobotsCronjob implements ICronjob {
                        }
                        
                        // clear spider cache
-                       CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.spider.php');
+                       SpiderCacheBuilder::getInstance()->reset();
                }
                
                // delete tmp file
index 7bdc71ae8eac481c7c11e9919ab83c600d593379..4be629151a8b66a7daf5279373b8f6922b1ca32e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\system\event;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\EventListenerCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\util\ClassUtil;
@@ -9,7 +9,7 @@ use wcf\util\ClassUtil;
  * EventHandler executes all registered actions for a specific event.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.event
@@ -51,12 +51,7 @@ class EventHandler extends SingletonFactory {
         */
        protected function loadActions() {
                $environment = (class_exists('wcf\system\WCFACP', false) ? 'admin' : 'user');
-               CacheHandler::getInstance()->addResource(
-                       'eventListener',
-                       WCF_DIR.'cache/cache.eventListener.php',
-                       'wcf\system\cache\builder\EventListenerCacheBuilder'
-               );
-               $cache = CacheHandler::getInstance()->get('eventListener');
+               $cache = EventListenerCacheBuilder::getInstance()->getData();
                
                if (isset($cache['actions'][$environment])) {
                        $this->actions = $cache['actions'][$environment];
index f25adb7000d116d4a042d9a1c089994afdf0685e..ffdc78175c28ce74f2acdc950b9aa4e81cb8a83f 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\language;
 use wcf\data\language\Language;
 use wcf\data\language\LanguageEditor;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\LanguageCacheBuilder;
 use wcf\system\template\TemplateScriptingCompiler;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
@@ -11,7 +11,7 @@ use wcf\system\WCF;
  * Handles language related functions.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.language
@@ -215,13 +215,7 @@ class LanguageFactory extends SingletonFactory {
         */
        protected function loadCache() {
                if (defined('WCF_N')) {
-                       CacheHandler::getInstance()->addResource(
-                               'language',
-                               WCF_DIR.'cache/cache.language.php',
-                               'wcf\system\cache\builder\LanguageCacheBuilder'
-                       );
-                       
-                       $this->cache = CacheHandler::getInstance()->get('language');
+                       $this->cache = LanguageCacheBuilder::getInstance()->getData();
                }
        }
        
@@ -229,7 +223,7 @@ class LanguageFactory extends SingletonFactory {
         * Clears languages cache.
         */
        public function clearCache() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+               LanguageCacheBuilder::getInstance()->reset();
        }
        
        /**
index a3451fd2f16ea8a33701eee77fd6f0381dc7bb9d..1d051c62bbbac503db049260df039c948d208199 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\menu\acp;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ACPMenuCacheBuilder;
 use wcf\system\menu\TreeMenu;
 
 /**
  * Builds the acp menu.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.menu.acp
@@ -24,11 +24,6 @@ class ACPMenu extends TreeMenu {
                        return;
                }
                
-               CacheHandler::getInstance()->addResource(
-                       'acpMenu',
-                       WCF_DIR.'cache/cache.acpMenu.php',
-                       'wcf\system\cache\builder\ACPMenuCacheBuilder'
-               );
-               $this->menuItems = CacheHandler::getInstance()->get('acpMenu');
+               $this->menuItems = ACPMenuCacheBuilder::getInstance()->getData();
        }
 }
index f0b440975ddbf3757b8c1ae8cc83113b458fcff6..714aad0fe4953ada3763d7c8770b7860d167f608 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\menu\page;
 use wcf\system\breadcrumb\Breadcrumb;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\PageMenuCacheBuilder;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\SystemException;
 use wcf\system\menu\ITreeMenuItem;
@@ -75,12 +75,7 @@ class PageMenu extends TreeMenu {
                parent::loadCache();
                
                // get cache
-               CacheHandler::getInstance()->addResource(
-                       'pageMenu',
-                       WCF_DIR.'cache/cache.pageMenu.php',
-                       'wcf\system\cache\builder\PageMenuCacheBuilder'
-               );
-               $this->menuItems = CacheHandler::getInstance()->get('pageMenu');
+               $this->menuItems = PageMenuCacheBuilder::getInstance()->getData();
        }
        
        /**
index b2acaa5d2da886366fb103716fbdaccd9f62a5ec..6cc683d1f4485fd370340972d51dece947fd1848 100644 (file)
@@ -3,7 +3,6 @@ namespace wcf\system\option;
 use wcf\data\option\category\OptionCategory;
 use wcf\data\option\Option;
 use wcf\system\application\ApplicationHandler;
-use wcf\system\cache\CacheHandler;
 use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\I18nHandler;
@@ -15,7 +14,7 @@ use wcf\util\StringUtil;
  * Handles options.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.option
@@ -28,12 +27,6 @@ class OptionHandler implements IOptionHandler {
         */
        protected $abbreviations = null;
        
-       /**
-        * cache name
-        * @var string
-        */
-       public $cacheName = '';
-       
        /**
         * cache class name
         * @var string
@@ -115,8 +108,7 @@ class OptionHandler implements IOptionHandler {
        /**
         * @see wcf\system\option\IOptionHandler::__construct()
         */
-       public function __construct($cacheName, $cacheClass, $supportI18n, $languageItemPattern = '', $categoryName = '') {
-               $this->cacheName = $cacheName;
+       public function __construct($cacheClass, $supportI18n, $languageItemPattern = '', $categoryName = '') {
                $this->cacheClass = $cacheClass;
                $this->categoryName = $categoryName;
                $this->languageItemPattern = $languageItemPattern;
@@ -395,17 +387,13 @@ class OptionHandler implements IOptionHandler {
         * Gets all options and option categories from cache.
         */
        protected function readCache() {
-               CacheHandler::getInstance()->addResource(
-                       $this->cacheName,
-                       WCF_DIR.'cache/cache.'.$this->cacheName.'.php',
-                       $this->cacheClass
-               );
+               $cache = call_user_func(array($this->cacheClass, 'getInstance'));
                
                // get cache contents
-               $this->cachedCategories = CacheHandler::getInstance()->get($this->cacheName, 'categories');
-               $this->cachedOptions = CacheHandler::getInstance()->get($this->cacheName, 'options');
-               $this->cachedCategoryStructure = CacheHandler::getInstance()->get($this->cacheName, 'categoryStructure');
-               $this->cachedOptionToCategories = CacheHandler::getInstance()->get($this->cacheName, 'optionToCategories');
+               $this->cachedCategories = $cache->getData(array(), 'categories');
+               $this->cachedOptions = $cache->getData(array(), 'options');
+               $this->cachedCategoryStructure = $cache->getData(array(), 'categoryStructure');
+               $this->cachedOptionToCategories = $cache->getData(array(), 'optionToCategories');
        }
        
        /**
index daff3c45a9ba18bb82fc3c6139d4286d8c7e6254..aab03e29ba889f1e09bf8526a351dc3183c7c46a 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 namespace wcf\system\package;
+use wcf\system\cache\builder\TemplateListenerCodeCacheBuilder;
+
+use wcf\system\cache\builder\TemplateListenerCacheBuilder;
+
 use wcf\data\application\Application;
 use wcf\data\application\ApplicationEditor;
 use wcf\data\language\category\LanguageCategory;
@@ -38,7 +42,7 @@ use wcf\util\StringUtil;
  * PackageInstallationDispatcher handles the whole installation process.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package
@@ -154,7 +158,7 @@ class PackageInstallationDispatcher {
                                
                                // remove all cache files after WCFSetup
                                if (!PACKAGE_ID) {
-                                       CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.*.php');
+                                       CacheHandler::getInstance()->flushAll();
                                }
                                
                                // rebuild application paths
@@ -163,7 +167,8 @@ class PackageInstallationDispatcher {
                        }
                        
                        // remove template listener cache
-                       CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener/', '*.php');
+                       TemplateListenerCacheBuilder::getInstance()->reset();
+                       TemplateListenerCodeCacheBuilder::getInstance()->reset();
                                
                        // reset language cache
                        LanguageFactory::getInstance()->clearCache();
@@ -758,7 +763,7 @@ class PackageInstallationDispatcher {
                LanguageEditor::deleteLanguageFiles();
                
                // reset all caches
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', '*');
+               CacheHandler::getInstance()->flushAll();
        }
        
        /**
index 659f30a04b135e9f7549c124e800b1ed8e78575b..5463d54bc5d3acd8e1e11983088d1ff97430aa6e 100644 (file)
@@ -6,6 +6,7 @@ use wcf\data\package\Package;
 use wcf\data\package\PackageEditor;
 use wcf\data\package\PackageList;
 use wcf\system\application\ApplicationHandler;
+use wcf\system\cache\builder\PackageCacheBuilder;
 use wcf\system\cache\CacheHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\SystemException;
@@ -21,7 +22,7 @@ use wcf\util\FileUtil;
  * Handles the whole uninstallation process.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package
@@ -73,19 +74,8 @@ class PackageUninstallationDispatcher extends PackageInstallationDispatcher {
                        // update options.inc.php if uninstallation is completed
                        OptionEditor::resetCache();
                        
-                       // force removal of all cache files
-                       $sql = "SELECT  packageDir
-                               FROM    wcf".WCF_N."_package
-                               WHERE   isApplication = ?";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute(array(1));
-                       while ($row = $statement->fetchArray()) {
-                               $dir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
-                               CacheHandler::getInstance()->clear($dir.'cache/', 'cache.*.php');
-                       }
-                       
-                       // remove template listener cache
-                       CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener/', '*.php');
+                       // clear cache
+                       CacheHandler::getInstance()->flushAll();
                        
                        // reset language cache
                        LanguageFactory::getInstance()->clearCache();
@@ -138,7 +128,7 @@ class PackageUninstallationDispatcher extends PackageInstallationDispatcher {
                ));
                
                // reset package cache
-               CacheHandler::getInstance()->clearResource('package');
+               PackageCacheBuilder::getInstance()->reset();
        }
        
        /**
index 90776f4f3839ec15cd4c2930489b560206c7d379..55d735c6f69ba446f41babb3d3f5314e5947aba1 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\package\plugin;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ACPSearchProviderCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Installs, updates and deletes ACP search providers.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -76,6 +76,6 @@ class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInsta
         * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
         */
        protected function cleanup() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider.php');
+               ACPSearchProviderCacheBuilder::getInstance()->reset();
        }
 }
index 12ab9dce0513c495b43f50242e0608bb1276124b..78ae3f58758aab938d74c1e847b2ba420a27cca6 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\package\plugin;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\CoreObjectCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Installs, updates and deletes core objects.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -67,6 +67,6 @@ class CoreObjectPackageInstallationPlugin extends AbstractXMLPackageInstallation
         * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
         */
        protected function cleanup() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObject.php');
+               CoreObjectCacheBuilder::getInstance()->reset();
        }
 }
index 479bca67a18e7309e835ccd81fd2197050fecbc1..26ce6b6fdae12e01c43544b29e54913c2133baaa 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\package\plugin;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\EventListenerCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Installs, updates and deletes event listeners.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -98,6 +98,6 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat
                parent::uninstall();
                
                // clear cache immediately
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.eventListener.php');
+               EventListenerCacheBuilder::getInstance()->reset();
        }
 }
index 70d9df02950bf40ab959e15c3c27a0420757ba72..6b25960d9bcc8582a2b7d517f0916f6cbc461fa5 100644 (file)
@@ -8,7 +8,7 @@ use wcf\util\FileUtil;
  * Executes individual PHP scripts during installation.
  * 
  * @author     Benjamin Kunz
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -34,7 +34,7 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin
                $path = FileUtil::getRealPath(WCF_DIR.$packageDir);
                
                // reset WCF cache
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', '*.php');
+               CacheHandler::getInstance()->flushAll();
                
                // run script
                $this->run($path.$this->instruction['value']);
index 97d7af2635a174a8f72c71c610b492b225387f18..c740716b85123db13202545f3f8540ded7237cf6 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 namespace wcf\system\package\plugin;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\SitemapCacheBuilder;
 use wcf\system\WCF;
 
 /**
  * Installs, updates and deletes sitemaps.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -72,6 +72,6 @@ class SitemapPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu
         * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
         */
        protected function cleanup() {
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap.php');
+               SitemapCacheBuilder::getInstance()->reset();
        }
 }
index 8ed707c80def40f734e3c4e45e9c89e6eb0baeb6..afa29925b715de67fe3ec07f914087de870faf7e 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 namespace wcf\system\package\plugin;
+use wcf\system\cache\builder\TemplateListenerCodeCacheBuilder;
+
+use wcf\system\cache\builder\TemplateListenerCacheBuilder;
 use wcf\system\cache\CacheHandler;
 use wcf\system\WCF;
 
@@ -7,7 +10,7 @@ use wcf\system\WCF;
  * Installs, updates and deletes template listeners.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -84,7 +87,7 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
         */
        protected function cleanup() {
                // clear cache immediately
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.templateListener.php');
-               CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener', '*.php');
+               TemplateListenerCacheBuilder::getInstance()->reset();
+               TemplateListenerCodeCacheBuilder::getInstance()->reset();
        }
 }
index f67c3fc19f3fe47d467cc97e7f58b97824a72fd7..c43a1e03ad8b3a5e5ababd1afdaaaf00b0518076 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\search\acp;
 use wcf\system\application\ApplicationHandler;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\ACPSearchProviderCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\util\ClassUtil;
@@ -10,7 +10,7 @@ use wcf\util\ClassUtil;
  * Handles ACP Search.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.search.acp
@@ -33,13 +33,7 @@ class ACPSearchHandler extends SingletonFactory {
         * @see wcf\system\SingletonFactory::init()
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'acpSearchProvider',
-                       WCF_DIR.'cache/cache.acpSearchProvider.php',
-                       'wcf\system\cache\builder\ACPSearchProviderCacheBuilder'
-               );
-               
-               $this->cache = CacheHandler::getInstance()->get('acpSearchProvider');
+               $this->cache = ACPSearchProviderCacheBuilder::getInstance()->getData();
        }
        
        /**
index 00108f2e8a8437d6ad76e5b9d9211b69f941069f..dc8f22de46a3cdf20ea6fab608ae5fbd4878e0b8 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\session;
 use wcf\data\user\User;
 use wcf\page\ITrackablePage;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\request\RequestHandler;
 use wcf\system\user\authentication\UserAuthenticationFactory;
@@ -16,7 +16,7 @@ use wcf\util\UserUtil;
  * Handles sessions.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.session
@@ -405,19 +405,8 @@ class SessionHandler extends SingletonFactory {
                        $groupIDs = $this->user->getGroupIDs();
                }
                
-               $groups = implode(',', $groupIDs);
-               $groupsFileName = StringUtil::getHash($groups);
-               
-               // register cache resource
-               $cacheName = 'userGroup-'.$groups;
-               CacheHandler::getInstance()->addResource(
-                       $cacheName,
-                       WCF_DIR.'cache/cache.userGroup-'.$groupsFileName.'.php',
-                       'wcf\system\cache\builder\UserGroupPermissionCacheBuilder'
-               );
-               
                // get group data from cache
-               $this->groupData = CacheHandler::getInstance()->get($cacheName);
+               $this->groupData = UserGroupPermissionCacheBuilder::getInstance()->getData($groupIDs);
                if (isset($this->groupData['groupIDs']) && $this->groupData['groupIDs'] != $groups) {
                        $this->groupData = array();
                }
index 92e54e14dd43f60991d5c8eee8c5355c47e80aa6..f94788917ac905335bf14edb2bc86ae0044b2ef1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\system\sitemap;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\SitemapCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 
@@ -8,7 +8,7 @@ use wcf\system\SingletonFactory;
  * Handles sitemap interactions.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage sitemap.sitemap
@@ -25,12 +25,7 @@ class SitemapHandler extends SingletonFactory {
         * @see wcf\system\SingletonFactory::init()
         */
        protected function init() {
-               CacheHandler::getInstance()->addResource(
-                       'sitemap',
-                       WCF_DIR.'cache/cache.sitemap.php',
-                       'wcf\system\cache\builder\SitemapCacheBuilder'
-               );
-               $this->cache = CacheHandler::getInstance()->get('sitemap');
+               $this->cache = SitemapCacheBuilder::getInstance()->get('sitemap');
        }
        
        /**
index 79f144bcca15a0a71954c8fbc8f5e67c1d90e8a4..c6943436bc70cabd0fab8235c59b315f7b0c61ee 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\style;
 use wcf\data\style\ActiveStyle;
 use wcf\data\style\Style;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\StyleCacheBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\request\RequestHandler;
 use wcf\system\SingletonFactory;
@@ -12,7 +12,7 @@ use wcf\system\WCF;
  * Handles styles.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.style
@@ -36,12 +36,7 @@ class StyleHandler extends SingletonFactory {
         */
        protected function init() {
                // load cache
-               CacheHandler::getInstance()->addResource(
-                       'style',
-                       WCF_DIR.'cache/cache.style.php',
-                       'wcf\system\cache\builder\StyleCacheBuilder'
-               );
-               $this->cache = CacheHandler::getInstance()->get('style');
+               $this->cache = StyleCacheBuilder::getInstance()->getData();
        }
        
        /**
index 7103d89f8ef359345e2a04b896cc520b03ec0694..07290558f41fe5ac856415b29bf4cd289ce1dca6 100755 (executable)
@@ -1,6 +1,8 @@
 <?php
 namespace wcf\system\template;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\TemplateGroupCacheBuilder;
+use wcf\system\cache\builder\TemplateListenerCacheBuilder;
+use wcf\system\cache\builder\TemplateListenerCodeCacheBuilder;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\SystemException;
 use wcf\system\Regex;
@@ -92,6 +94,12 @@ class TemplateEngine extends SingletonFactory {
         */
        protected $templateListeners = array();
        
+       /**
+        * true, if template listener code was already loaded
+        * @var boolean
+        */
+       protected $templateListenersLoaded = false;
+       
        /**
         * current environment
         * @var string
@@ -431,16 +439,6 @@ class TemplateEngine extends SingletonFactory {
                                        }
                                }
                                
-                               // check for template listeners
-                               if ($this->hasTemplateListeners($templateName)) {
-                                       $this->loadTemplateListenerCode($templateName);
-                                       
-                                       $templateListenerCache = WCF_DIR.'cache/templateListener/'.$this->environment.'-'.$templateName.'.php';
-                                       $templateListenerCacheMTime = @filemtime($templateListenerCache);
-                                       
-                                       return !($sourceMTime >= $templateListenerCacheMTime);
-                               }
-                               
                                return true;
                        }
                }
@@ -641,12 +639,7 @@ class TemplateEngine extends SingletonFactory {
         * Loads cached template group information.
         */
        protected function loadTemplateGroupCache() {
-               CacheHandler::getInstance()->addResource(
-                       'templateGroup',
-                       WCF_DIR.'cache/cache.templateGroup.php',
-                       'wcf\system\cache\builder\TemplateGroupCacheBuilder'
-               );
-               $this->templateGroupCache = CacheHandler::getInstance()->get('templateGroup');
+               $this->templateGroupCache = TemplateGroupCacheBuilder::getInstance()->getData();
        }
        
        /**
@@ -719,14 +712,7 @@ class TemplateEngine extends SingletonFactory {
         * Loads all available template listeners.
         */
        protected function loadTemplateListeners() {
-               $cacheName = 'templateListener-'.$this->environment;
-               CacheHandler::getInstance()->addResource(
-                       $cacheName,
-                       WCF_DIR.'cache/cache.'.$cacheName.'.php',
-                       'wcf\system\cache\builder\TemplateListenerCacheBuilder'
-               );
-               
-               $this->templateListeners = CacheHandler::getInstance()->get($cacheName);
+               $this->templateListeners = TemplateListenerCacheBuilder::getInstance()->getData(array('environment' => $this->environment));
        }
        
        /**
@@ -745,21 +731,13 @@ class TemplateEngine extends SingletonFactory {
        }
        
        /**
-        * Loads template code for specified template.
-        * 
-        * @param       string          $templateName
+        * Loads template listener code.
         */
-       protected function loadTemplateListenerCode($templateName) {
-               // cache was already loaded
-               if (!isset($this->templateListeners[$templateName]) || !empty($this->templateListeners[$templateName])) return;
-               
-               $cacheName = $this->environment.'-'.$templateName;
-               CacheHandler::getInstance()->addResource(
-                       $cacheName,
-                       WCF_DIR.'cache/templateListener/'.$cacheName.'.php',
-                       'wcf\system\cache\builder\TemplateListenerCodeCacheBuilder'
-               );
-               $this->templateListeners[$templateName] = CacheHandler::getInstance()->get($cacheName);
+       protected function loadTemplateListenerCode() {
+               if (!$this->templateListenersLoaded) {
+                       $this->templateListeners = TemplateListenerCodeCacheBuilder::getInstance()->getData(array('environment' => $this->environment));
+                       $this->templateListenersLoaded = true;
+               }
        }
        
        /**
@@ -770,7 +748,7 @@ class TemplateEngine extends SingletonFactory {
         * @return      string
         */
        public function getTemplateListenerCode($templateName, $eventName) {
-               $this->loadTemplateListenerCode($templateName);
+               $this->loadTemplateListenerCode();
                
                if (isset($this->templateListeners[$templateName][$eventName])) {
                        return implode("\n", $this->templateListeners[$templateName][$eventName]);
index a01decd83c57401159b6eb789b2dbb2528bd4d49..0789323e84d1361c8518c7c93457ee45dfd8a7cb 100644 (file)
@@ -2,14 +2,14 @@
 namespace wcf\system\version;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\VersionableDatabaseObject;
-use wcf\system\cache\CacheHandler;
+use wcf\system\cache\builder\VersionCacheBuilder;
 use wcf\system\SingletonFactory;
 
 /**
  * Handles versions of DatabaseObjects.
  * 
  * @author     Jeffrey Reichardt
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.version
@@ -107,18 +107,16 @@ class VersionHandler extends SingletonFactory {
                foreach ($this->objectTypes as $objectType) {
                        $this->objectTypeIDs[$objectType->objectTypeID] = $objectType->objectType;
                }
-
-               $cacheName = 'version';
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\VersionCacheBuilder');
-               $this->versions = CacheHandler::getInstance()->get($cacheName, 'versions');
-               $this->versionIDs = CacheHandler::getInstance()->get($cacheName, 'versionIDs');
+               
+               $this->versions = VersionCacheBuilder::getInstance()->getData(array(), 'versions');
+               $this->versionIDs = VersionCacheBuilder::getInstance()->getData(array(), 'versionIDs');
        }
 
        /**
         * Reloads the version cache.
         */
        public function reloadCache() {
-               CacheHandler::getInstance()->clearResource('version');
+               VersionCacheBuilder::getInstance()->reset();
 
                $this->init();
        }
index cb71a40c7b3c464c5dda550db8f017aa2cd29bd3..eb6535581e9a7a9e075f1e7ba33b9f90d488e1d1 100644 (file)
@@ -133,25 +133,6 @@ CREATE TABLE wcf1_category (
        additionalData TEXT
 );
 
-DROP TABLE IF EXISTS wcf1_cleanup_listener;
-CREATE TABLE wcf1_cleanup_listener (
-       listenerID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-       packageID INT(10) NOT NULL,
-       className VARCHAR(255) NOT NULL DEFAULT '',
-       objectType VARCHAR(255) NOT NULL DEFAULT '',
-       lastUpdateTime INT(10) NOT NULL DEFAULT 0,
-       UNIQUE KEY (className, packageID)
-);
-
-DROP TABLE IF EXISTS wcf1_cleanup_log;
-CREATE TABLE wcf1_cleanup_log (
-       packageID INT(10) NOT NULL DEFAULT 0,
-       objectType VARCHAR(255) NOT NULL DEFAULT '',
-       objectID INT(10) NOT NULL DEFAULT 0,
-       deleteTime INT(10) NOT NULL DEFAULT 0,
-       KEY objectType (objectType)
-);
-
 DROP TABLE IF EXISTS wcf1_clipboard_action;
 CREATE TABLE wcf1_clipboard_action (
        actionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -794,10 +775,6 @@ ALTER TABLE wcf1_application ADD FOREIGN KEY (packageID) REFERENCES wcf1_package
 
 ALTER TABLE wcf1_category ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
 
-ALTER TABLE wcf1_cleanup_listener ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-
-ALTER TABLE wcf1_cleanup_log ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-
 ALTER TABLE wcf1_clipboard_action ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
 
 ALTER TABLE wcf1_clipboard_item ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;