From a0bcecc9ecf8a2548282ed3217403cb3c0900835 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Nov 2012 00:13:07 +0100 Subject: [PATCH] Removing cache after application group create/delete --- .../application/ApplicationAction.class.php | 20 ++++++++++++++++++- .../group/ApplicationGroupAction.class.php | 9 +++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php index 2fa25a99a6..88f53ffafe 100644 --- a/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php +++ b/wcfsetup/install/files/lib/data/application/ApplicationAction.class.php @@ -1,6 +1,8 @@ commitTransaction(); + + $this->clearCache(); } /** @@ -90,7 +94,7 @@ class ApplicationAction extends AbstractDatabaseObjectAction { if (empty($this->objects)) { $this->readObjects(); } - + $this->clearCache(); $sql = "UPDATE wcf".WCF_N."_application SET groupID = ?, cookieDomain = domainName, @@ -106,5 +110,19 @@ class ApplicationAction extends AbstractDatabaseObjectAction { )); } WCF::getDB()->commitTransaction(); + + $this->clearCache(); + } + + /** + * Clears application cache. + */ + protected function clearCache() { + foreach ($this->objects as $application) { + $directory = PackageCache::getInstance()->getPackage($application->packageID)->packageDir; + $directory = FileUtil::getRealPath(WCF_DIR.$directory); + + CacheHandler::getInstance()->clear($directory.'cache', '*.php'); + } } } diff --git a/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php b/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php index 3db19655c1..be1c5aabfb 100644 --- a/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php @@ -3,6 +3,8 @@ namespace wcf\data\application\group; use wcf\data\application\ApplicationAction; use wcf\data\application\ApplicationList; use wcf\data\AbstractDatabaseObjectAction; +use wcf\system\cache\CacheHandler; +use wcf\system\language\LanguageFactory; /** * Executes application group-related actions. @@ -57,6 +59,13 @@ class ApplicationGroupAction extends AbstractDatabaseObjectAction { $applicationAction = new ApplicationAction($applicationList->getObjects(), 'ungroup'); $applicationAction->executeAction(); + // delete language cache and compiled templates + LanguageFactory::getInstance()->deleteLanguageCache(); + + // delete WCF cache + CacheHandler::getInstance()->clear(WCF_DIR.'cache', '*.php'); + CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener', '*.php'); + return parent::delete(); } } -- 2.20.1