From 6aa8ba2da678477b7fc1e99cb0333031bb568a9b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 9 Feb 2012 17:21:13 +0100 Subject: [PATCH] Cache is now cleared upon installation Fixes #414 --- .../acp/action/InstallPackageAction.class.php | 25 +++++++++++++++++++ .../action/UninstallPackageAction.class.php | 1 + 2 files changed, 26 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php index 80fe0a42da..678d20a9fe 100755 --- a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php @@ -1,5 +1,9 @@ getNode() == '') { // perform final actions $this->installation->completeSetup(); + $this->finalize($queueID); // redirect to application if not already within one if (PACKAGE_ID == 1) { @@ -199,4 +204,24 @@ class InstallPackageAction extends AbstractDialogAction { return $currentAction; } + + /** + * Clears resources after successful installation. + * + * @param integer $queueID + */ + protected function finalize($queueID) { + // clear cache + $sql = "SELECT packageDir + FROM wcf".WCF_N."_package + WHERE isApplication = 1"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + + while ($row = $statement->fetchArray()) { + $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']); + + CacheHandler::getInstance()->clear($packageDir, '*.php'); + } + } } diff --git a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php index 654dd4604a..fc36e0a3a9 100644 --- a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php @@ -110,6 +110,7 @@ class UninstallPackageAction extends InstallPackageAction { if ($node == '') { // remove node data $this->installation->nodeBuilder->purgeNodes(); + $this->finalize($queueID); // redirect to application if not already within one if (PACKAGE_ID == 1) { -- 2.20.1