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
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'));
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
* 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();
}
}
*/
public $errorType = array();
- /**
- * cache name
- * @var string
- */
- public $cacheName = 'option';
-
/**
* cache class name
* @var string
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();
}
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;
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
*/
public $menuItemName = 'wcf.acp.menu.link.group.add';
- /**
- * @see wcf\acp\form\AbstractOptionListForm::$cacheName
- */
- public $cacheName = 'userGroupOption';
-
/**
* option tree
* @var array
* @category Community Framework
*/
abstract class UserOptionListForm extends AbstractOptionListForm {
- /**
- * @see wcf\acp\form\AbstractOptionListForm::$cacheName
- */
- public $cacheName = 'userOption';
-
/**
* @see wcf\acp\form\AbstractOptionListForm::$supportI18n
*/
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;
* 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
* 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);
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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.application.php');
+ ApplicationCacheBuilder::getInstance()->reset();
}
}
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;
* 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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.category.php');
+ CategoryCacheBuilder::getInstance()->reset();
}
}
+++ /dev/null
-<?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';
-}
+++ /dev/null
-<?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';
-}
+++ /dev/null
-<?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';
-}
+++ /dev/null
-<?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';
-}
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;
* 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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.cronjob.php');
+ CronjobCacheBuilder::getInstance()->reset();
}
}
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;
* 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
* Clears language cache.
*/
public function clearCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+ LanguageCacheBuilder::getInstance()->reset();
}
/**
<?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
*/
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])) {
* Resets and reloads the object type cache.
*/
public function resetCache() {
- CacheHandler::getInstance()->clearResource('objectType');
+ ObjectTypeCacheBuilder::getInstance()->reset();
$this->init();
}
}
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;
* 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
*/
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();
<?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
* @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();
}
/**
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.
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.package.php');
+ PackageCacheBuilder::getInstance()->reset();
}
}
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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.pageMenu.php');
+ PageMenuCacheBuilder::getInstance()->reset();
}
}
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;
* 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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.style.php');
+ StyleCacheBuilder::getInstance()->reset();
}
/**
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;
* 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
* 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');
}
/**
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;
* 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
*/
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();
}
}
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;
* 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
*/
public static function resetCache() {
// clear cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroup*');
+ UserGroupCacheBuilder::getInstance()->reset();
+ UserGroupPermissionCacheBuilder::getInstance()->reset();
// clear sessions
SessionHandler::resetSessions();
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
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroup*.php');
+ UserGroupOptionCacheBuilder::getInstance()->reset();
}
}
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;
* 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?
}
/**
return;
}
- self::$coreObjectCache = CacheHandler::getInstance()->get('coreObject');
+ self::$coreObjectCache = CoreObjectCacheBuilder::getInstance()->getData();
}
/**
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;
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?
}
/**
*/
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;
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;
LanguageFactory::getInstance()->makeDefault($language->languageID);
// rebuild language cache
- CacheHandler::getInstance()->clearResource('language');
+ LanguageCacheBuilder::getInstance()->reset();
// go to next step
$this->gotoNextStep('createUser');
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;
* 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
*/
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();
}
/**
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
* 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();
}
/**
}
/**
- * Flushed cache for given resource.
+ * Flush cache for given resource.
*
* @param wcf\system\cache\builder\ICacheBuilder $cacheBuilder
* @param array $parameters
$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.
*
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
// 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;
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;
* 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
$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();
}
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;
* 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
* @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();
}
}
+++ /dev/null
-<?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
- ));
- }
- }
-}
+++ /dev/null
-<?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);
-}
<?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;
* 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
$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();
}
/**
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();
}
/**
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;
* 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
* 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();
}
}
<?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;
* 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
}
// clear spider cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.spider.php');
+ SpiderCacheBuilder::getInstance()->reset();
}
// delete tmp file
<?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;
* 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
*/
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];
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;
* 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
*/
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();
}
}
* Clears languages cache.
*/
public function clearCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+ LanguageCacheBuilder::getInstance()->reset();
}
/**
<?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
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();
}
}
<?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;
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();
}
/**
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;
* 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
*/
protected $abbreviations = null;
- /**
- * cache name
- * @var string
- */
- public $cacheName = '';
-
/**
* cache class name
* @var string
/**
* @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;
* 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');
}
/**
<?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;
* 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
// remove all cache files after WCFSetup
if (!PACKAGE_ID) {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.*.php');
+ CacheHandler::getInstance()->flushAll();
}
// rebuild application paths
}
// remove template listener cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener/', '*.php');
+ TemplateListenerCacheBuilder::getInstance()->reset();
+ TemplateListenerCodeCacheBuilder::getInstance()->reset();
// reset language cache
LanguageFactory::getInstance()->clearCache();
LanguageEditor::deleteLanguageFiles();
// reset all caches
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', '*');
+ CacheHandler::getInstance()->flushAll();
}
/**
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;
* 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
// 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();
));
// reset package cache
- CacheHandler::getInstance()->clearResource('package');
+ PackageCacheBuilder::getInstance()->reset();
}
/**
<?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
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider.php');
+ ACPSearchProviderCacheBuilder::getInstance()->reset();
}
}
<?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
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObject.php');
+ CoreObjectCacheBuilder::getInstance()->reset();
}
}
<?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
parent::uninstall();
// clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.eventListener.php');
+ EventListenerCacheBuilder::getInstance()->reset();
}
}
* 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
$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']);
<?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
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap.php');
+ SitemapCacheBuilder::getInstance()->reset();
}
}
<?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;
* 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
*/
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();
}
}
<?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;
* 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
* @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();
}
/**
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;
* 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
$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();
}
<?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;
* 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
* @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');
}
/**
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;
* 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
*/
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();
}
/**
<?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;
*/
protected $templateListeners = array();
+ /**
+ * true, if template listener code was already loaded
+ * @var boolean
+ */
+ protected $templateListenersLoaded = false;
+
/**
* current environment
* @var string
}
}
- // 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;
}
}
* 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();
}
/**
* 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));
}
/**
}
/**
- * 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;
+ }
}
/**
* @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]);
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
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();
}
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,
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;