From 55bd5129a5c52053b7db341744c66813387d73ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 9 Feb 2012 18:49:14 +0100 Subject: [PATCH] Adding CacheClearAction This class was handcoded with nano! --- .../lib/acp/action/CacheClearAction.class.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php diff --git a/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php b/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php new file mode 100644 index 0000000000..73f9beed7d --- /dev/null +++ b/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php @@ -0,0 +1,57 @@ + + * @package com.woltlab.wcf + * @subpackage acp.action + * @category Community Framework + */ +class CacheClearAction extends AbstractAction { + /** + * @see wcf\action\IAction::execute() + */ + public function execute() { + parent::execute(); + WCF::getSession()->checkPermissions(array('admin.system.canViewLog')); + + // this will clean up the templates as well + LanguageFactory::getInstance()->deleteLanguageCache(); + + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies())); + $conditions->add("isApplication = ?", array(1)); + + // get package dirs + $sql = "SELECT packageDir + FROM wcf".WCF_N."_package + ".$conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + while ($row = $statement->fetchArray()) { + $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']); + try { + CacheHandler::getInstance()->clear($packageDir.'cache', '*.php'); + } + catch (SystemException $e) { + } + } + $this->executed(); + HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList')); + exit; + } +} -- 2.20.1