Fixed cache reset after (un-)install
authorAlexander Ebert <ebert@woltlab.com>
Fri, 7 Dec 2012 02:37:23 +0000 (03:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 7 Dec 2012 02:37:23 +0000 (03:37 +0100)
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php

index b6a8014e9880ca8079ed8624e4de0e7ebfbb8967..50c3ea4ba6c5827122c2639fe2b276551771979f 100644 (file)
@@ -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;
index 99db43192e5b4ff3b82f05c525ed5ed04164d482..7da14fd96ab0046eddbcf384cee22622f0d4e387 100644 (file)
@@ -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();
                }