From 07e26cb9a28b6e846a9bc36e3d419450685e0bd9 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 7 Dec 2012 03:37:23 +0100 Subject: [PATCH] Fixed cache reset after (un-)install --- .../PackageInstallationDispatcher.class.php | 11 ++++++- .../PackageUninstallationDispatcher.class.php | 33 +++++++++++-------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index b6a8014e98..50c3ea4ba6 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -130,11 +130,13 @@ class PackageInstallationDispatcher { $node = $this->nodeBuilder->getNextNode($node); $step->setNode($node); - // update options.inc.php and save localized package infos + // perform post-install/update actions if ($node == '') { + // update options.inc.php OptionEditor::resetCache(); if ($this->action == 'install') { + // save localized package infos $this->saveLocalizedPackageInfos(); // remove all cache files after WCFSetup @@ -146,6 +148,13 @@ class PackageInstallationDispatcher { ApplicationHandler::rebuild(); ApplicationEditor::setup(); } + + // remove template listener cache + CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener/', '*.php'); + + // reset language cache + LanguageFactory::getInstance()->clearCache(); + LanguageFactory::getInstance()->deleteLanguageCache(); } return $step; diff --git a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php index 99db43192e..7da14fd96a 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php @@ -9,6 +9,7 @@ use wcf\system\application\ApplicationHandler; use wcf\system\cache\CacheHandler; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\SystemException; +use wcf\system\language\LanguageFactory; use wcf\system\request\LinkHandler; use wcf\system\setup\Uninstaller; use wcf\system\WCF; @@ -66,25 +67,29 @@ class PackageUninstallationDispatcher extends PackageInstallationDispatcher { $this->nodeBuilder->completeNode($node); $node = $this->nodeBuilder->getNextNode($node); - // update options.inc.php if uninstallation is completed + // perform post-uninstall actions if ($node == '') { + // update options.inc.php if uninstallation is completed OptionEditor::resetCache(); - // force removal of all WCF cache files - CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.*.php'); - - if (PACKAGE_ID != 1) { - $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'); - } + // 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'); + + // reset language cache + LanguageFactory::getInstance()->clearCache(); + LanguageFactory::getInstance()->deleteLanguageCache(); + // rebuild application paths ApplicationHandler::rebuild(); } -- 2.20.1