Clean up compiled css when cache is cleared
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 1 Feb 2013 13:44:12 +0000 (14:44 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Sat, 2 Feb 2013 20:00:38 +0000 (21:00 +0100)
wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php
wcfsetup/install/files/lib/acp/page/CacheListPage.class.php
wcfsetup/install/lang/de.xml

index 24e5e6cc17f410bb2c961b251fac2e702d21ff07..273d756c3fef32687dd276e45890a4ad0a890362 100644 (file)
@@ -5,6 +5,7 @@ use wcf\system\cache\CacheHandler;
 use wcf\system\exception\SystemException;
 use wcf\system\language\LanguageFactory;
 use wcf\system\request\LinkHandler;
+use wcf\system\style\StyleHandler;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
 use wcf\util\HeaderUtil;
@@ -31,6 +32,9 @@ class CacheClearAction extends AbstractAction {
        public function execute() {
                parent::execute();
                
+               // reset stylesheets
+               StyleHandler::resetStylesheets();
+               
                // delete language cache and compiled templates as well
                LanguageFactory::getInstance()->deleteLanguageCache();
                
index f3750ed014cf7a03f9ed8a6e65e2037e8683b3f2..0232e6320577b9037cbf22ad4fc5c432dc8812a5 100755 (executable)
@@ -157,6 +157,8 @@ class CacheListPage extends AbstractPage {
                $this->readCacheFiles('language', FileUtil::unifyDirSeperator(WCF_DIR.'language'));
                $this->readCacheFiles('template', FileUtil::unifyDirSeperator(WCF_DIR.'templates/compiled'), new Regex('\.meta\.php$'));
                $this->readCacheFiles('template', FileUtil::unifyDirSeperator(WCF_DIR.'acp/templates/compiled'), new Regex('\.meta\.php$'));
+               $this->readCacheFiles('style', FileUtil::unifyDirSeperator(WCF_DIR.'style'), null, 'css');
+               $this->readCacheFiles('style', FileUtil::unifyDirSeperator(WCF_DIR.'acp/style'), new Regex('^WCFSetup.css$'), 'css');
        }
        
        /**
@@ -166,7 +168,7 @@ class CacheListPage extends AbstractPage {
         * @param       strign                  $cacheDir
         * @param       wcf\system\Regex        $ignore
         */
-       protected function readCacheFiles($cacheType, $cacheDir, Regex $ignore = null) {
+       protected function readCacheFiles($cacheType, $cacheDir, Regex $ignore = null, $extension = 'php') {
                if (!isset($this->cacheData[$cacheType])) {
                        $this->cacheData[$cacheType] = array();
                }
@@ -179,7 +181,7 @@ class CacheListPage extends AbstractPage {
                        return;
                }
                
-               $files = $directoryUtil->getFileObjects(SORT_ASC, new Regex('\.php$'));
+               $files = $directoryUtil->getFileObjects(SORT_ASC, new Regex('\.'.$extension.'$'));
                
                // get additional file information
                $data = array();
index 2f872ab94c486d6a7dae2d6fe22cbe74c4b32a19..67d2600e1ecd6ee7cc9168933f55cc4dfcf4fd7a 100644 (file)
@@ -56,6 +56,7 @@
                <item name="wcf.acp.cache.source.type.NoCacheSource"><![CDATA[keine (Caching deaktiviert)]]></item>
                <item name="wcf.acp.cache.type.data"><![CDATA[Daten]]></item>
                <item name="wcf.acp.cache.type.language"><![CDATA[Sprachen]]></item>
+               <item name="wcf.acp.cache.type.style"><![CDATA[Stile]]></item>
                <item name="wcf.acp.cache.type.template"><![CDATA[Templates]]></item>
        </category>