Show language and compiled templates in CacheListPage
authorTim Düsterhus <timwolla@arcor.de>
Wed, 8 Feb 2012 16:18:27 +0000 (17:18 +0100)
committerTim Düsterhus <timwolla@arcor.de>
Wed, 8 Feb 2012 16:18:27 +0000 (17:18 +0100)
And collapse the containers by default, as there are now 5 “Sources”

wcfsetup/install/files/acp/templates/cacheList.tpl
wcfsetup/install/files/lib/acp/page/CacheListPage.class.php

index 8bcfbb09a249f697fa080c2d8ef7b969c3bc9232..4daf5766e07de1b29ce39ec918504acf69925d98 100644 (file)
        {counter name=cacheIndex assign=cacheIndex print=false start=0}
        {if $files|count}
                <div class="wcf-border wcf-boxTitle">
-                       <a class="collapsible" data-is-open="1" data-collapsible-container="cache{@$cacheIndex}"><img src="{@RELATIVE_WCF_DIR}icon/opened2.svg" alt="" title="{lang}wcf.global.button.collapsible{/lang}" class="balloonTooltip" /></a>
+                       <a class="collapsible" data-is-open="0" data-collapsible-container="cache{@$cacheIndex}"><img src="{@RELATIVE_WCF_DIR}icon/closed2.svg" alt="" title="{lang}wcf.global.button.collapsible{/lang}" class="balloonTooltip" /></a>
                        <hgroup>
                                <h1>{$cache} <span class="badge" title="{lang}wcf.acp.cache.data.files.count{/lang}">{#$files|count}</span></h1>
                        </hgroup>
                        
-                       <table id="cache{@$cacheIndex}">
+                       <table id="cache{@$cacheIndex}" style="display: none;">
                                <thead>
                                        <tr>
                                                <th class="columnTitle">{lang}wcf.acp.cache.list.name{/lang}</th>
index c1f6d353a0d64705866ddb747ec95e47b89fbca4..c3fde1d5e4b685e155a882d0ab08c6457a7fa2ae 100755 (executable)
@@ -71,6 +71,30 @@ class CacheListPage extends AbstractPage {
                        'files' => 0
                );
                
+               $_this = $this;
+               $readFileCache = function($cacheDir) use ($_this) {
+                       $_this->caches[$cacheDir] = array();
+                       
+                       // get files in cache directory
+                       $files = glob($cacheDir.'/*.php');
+                       // get additional file information
+                       if (is_array($files)) {
+                               foreach ($files as $file) {
+                                       $filesize = filesize($file);
+                                       $_this->caches[$cacheDir][] = array(
+                                               'filename' => basename($file),
+                                               'filesize' => $filesize,
+                                               'mtime' => filemtime($file),
+                                               'perm' => substr(sprintf('%o', fileperms($file)), -3),
+                                               'writable' => is_writable($file)
+                                       );
+                                       
+                                       $_this->cacheData['files']++;
+                                       $_this->cacheData['size'] += $filesize;
+                               }
+                       }
+               };
+               
                // filesystem cache
                if ($this->cacheData['source'] == 'wcf\system\cache\source\DiskCacheSource') {
                        // set version
@@ -88,29 +112,7 @@ class CacheListPage extends AbstractPage {
                        $statement->execute($conditions->getParameters());
                        while ($row = $statement->fetchArray()) {
                                $packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
-                               $cacheDir = $packageDir.'cache';
-                               if (file_exists($cacheDir)) {
-                                       $this->caches[$cacheDir] = array();
-
-                                       // get files in cache directory
-                                       $files = glob($cacheDir.'/*.php');
-                                       // get additional file information
-                                       if (is_array($files)) {
-                                               foreach ($files as $file) {
-                                                       $filesize = filesize($file);
-                                                       $this->caches[$cacheDir][] = array(
-                                                               'filename' => basename($file),
-                                                               'filesize' => $filesize,
-                                                               'mtime' => filemtime($file),
-                                                               'perm' => substr(sprintf('%o', fileperms($file)), -3),
-                                                               'writable' => is_writable($file)
-                                                       );
-                                                       
-                                                       $this->cacheData['files']++;
-                                                       $this->cacheData['size'] += $filesize;
-                                               }
-                                       }
-                               }
+                               $readFileCache($packageDir.'cache');
                        }
                }
                // memcache
@@ -150,7 +152,7 @@ class CacheListPage extends AbstractPage {
                        foreach ($cacheList as $cache) {
                                $cachePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(dirname($cache['info'])));
                                if (isset($packageNames[$cachePath])) {
-                                       // Use the pacakgeName + the instance number, because pathes could confuse the administrator.
+                                       // Use the packageName + the instance number, because pathes could confuse the administrator.
                                        // He could think this is a file cache. If instanceName would be unique, we could use it instead.
                                        $packageName = $packageNames[$cachePath];
                                        if (!isset($this->caches[$packageName])) $this->caches[$packageName] = array();
@@ -172,6 +174,10 @@ class CacheListPage extends AbstractPage {
                        $this->cacheData['version'] = WCF_VERSION;
                        $this->cacheData['files'] = $this->cacheData['size'] = 0;
                }
+               
+               $readFileCache(WCF_DIR.'language');
+               $readFileCache(WCF_DIR.'templates/compiled');
+               $readFileCache(WCF_DIR.'acp/templates/compiled');
        }
        
        /**