<dl>
<dt>{lang}wcf.acp.cache.data.source{/lang}</dt>
- <dd>{$cacheData.source}</dd>
+ <dd>
+ {assign var='__source' value='\\'|explode:$cacheData.source}
+ {lang}wcf.acp.cache.source.type.{$__source|array_pop}{/lang}
+ <small>{$cacheData.source}</small>
+ </dd>
</dl>
{if $cacheData.version}
<dl>
</nav>
</div>
-{foreach from=$caches key=cache item=files}
- {counter name=cacheIndex assign=cacheIndex print=false start=0}
- {if $files|count}
- <div class="tabularBox tabularBoxTitle marginTop shadow">
- <hgroup>
- <h1><a class="jsCollapsible" data-is-open="0" data-collapsible-container="cache{@$cacheIndex}"><img src="{@$__wcf->getPath()}icon/arrowRightInverse.svg" alt="" title="{lang}wcf.global.button.collapsible{/lang}" class="icon16 jsTooltip" /></a> {$cache} <span class="badge badgeInverse" title="{lang}wcf.acp.cache.data.files.count{/lang}">{#$files|count}</span></h1>
- </hgroup>
-
- <table id="cache{@$cacheIndex}" style="display: none;" class="table">
- <thead>
- <tr>
- <th class="columnTitle">{lang}wcf.acp.cache.list.name{/lang}</th>
- <th class="columnDigits">{lang}wcf.acp.cache.list.size{/lang}</th>
- <th class="columnDate">{lang}wcf.acp.cache.list.mtime{/lang}</th>
- {if $files.0.perm|isset}
- <th class="columnDigits">{lang}wcf.acp.cache.list.perm{/lang}</th>
- {/if}
- </tr>
- </thead>
+{foreach from=$caches key='cacheType' item='cacheTypeCaches'}
+ {foreach from=$cacheTypeCaches key='cache' item='files'}
+ {counter name=cacheIndex assign=cacheIndex print=false start=0}
+
+ {if $files|count}
+ <div class="tabularBox tabularBoxTitle marginTop shadow">
+ <hgroup>
+ <h1><a class="jsCollapsible" data-is-open="0" data-collapsible-container="cache{@$cacheIndex}"><img src="{@$__wcf->getPath()}icon/arrowRightInverse.svg" alt="" title="{lang}wcf.global.button.collapsible{/lang}" class="icon16 jsTooltip" /></a> {lang}wcf.acp.cache.type.{$cacheType}{/lang} <span class="badge badgeInverse" title="{lang}wcf.acp.cache.data.files.count{/lang}">{#$files|count}</span></h1>
+ <h2>{$cache}</h2>
+ </hgroup>
- <tbody>
- {foreach from=$files item=file}
- <tr>
- <td class="columnTitle"><p>{$file.filename}</td>
- <td class="columnDigits"><p>{@$file.filesize|filesize}</td>
- <td class="columnDate">{if $file.mtime > 1}<p>{@$file.mtime|time}</p>{/if}</td>
- {if $file.perm|isset}
- <td class="columnDigits"><p{if !$file.writable} style="color: #c00"{/if}>{@$file.perm}</p></td>
- {/if}
- </tr>
- {/foreach}
- </tbody>
- </table>
- </div>
- {/if}
+ <table id="cache{@$cacheIndex}" style="display: none;" class="table">
+ <thead>
+ <tr>
+ <th class="columnTitle">{lang}wcf.acp.cache.list.name{/lang}</th>
+ <th class="columnDigits">{lang}wcf.acp.cache.list.size{/lang}</th>
+ <th class="columnDate">{lang}wcf.acp.cache.list.mtime{/lang}</th>
+ {if $files.0.perm|isset}
+ <th class="columnDigits">{lang}wcf.acp.cache.list.perm{/lang}</th>
+ {/if}
+ </tr>
+ </thead>
+
+ <tbody>
+ {foreach from=$files item=file}
+ <tr>
+ <td class="columnTitle"><p>{$file.filename}</td>
+ <td class="columnDigits"><p>{@$file.filesize|filesize}</td>
+ <td class="columnDate">{if $file.mtime > 1}<p>{@$file.mtime|time}</p>{/if}</td>
+ {if $file.perm|isset}
+ <td class="columnDigits"><p{if !$file.writable} style="color: #c00"{/if}>{@$file.perm}</p></td>
+ {/if}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+ </div>
+ {/if}
+ {/foreach}
{/foreach}
<div class="contentNavigation">
'files' => 0
);
- $_this = $this;
- $readFileCache = function($cacheDir, Regex $ignore = null) use ($_this) {
- $_this->caches[$cacheDir] = array();
+ switch ($this->cacheData['source']) {
+ case 'wcf\system\cache\source\DiskCacheSource':
+ // set version
+ $this->cacheData['version'] = WCF_VERSION;
+
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
+ $conditions->add("isApplication = ?", array(1));
+
+ // get package dirs
+ $sql = "SELECT packageDir
+ FROM wcf".WCF_N."_package
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
+ while ($row = $statement->fetchArray()) {
+ $packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
+ $this->readCacheFiles('data', $packageDir.'cache');
+ }
+ break;
- // get files in cache directory
- try {
- $directoryUtil = DirectoryUtil::getInstance($cacheDir);
- }
- catch(SystemException $e) {
- return;
- }
- $files = $directoryUtil->getFileObjects(SORT_ASC, new Regex('\.php$'));
- // get additional file information
- if (is_array($files)) {
- foreach ($files as $file) {
- if ($ignore !== null) if ($ignore->match($file)) continue;
- $_this->caches[$cacheDir][] = array(
- 'filename' => $file->getBasename(),
- 'filesize' => $file->getSize(),
- 'mtime' => $file->getMtime(),
- 'perm' => substr(sprintf('%o', $file->getPerms()), -3),
- 'writable' => $file->isWritable()
- );
-
- $_this->cacheData['files']++;
- $_this->cacheData['size'] += $file->getSize();
+ case 'wcf\system\cache\source\MemcacheCacheSource':
+ // set version
+ $this->cacheData['version'] = WCF_VERSION;
+
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
+ $conditions->add("isApplication = ?", array(1));
+
+ // get package dirs
+ $sql = "SELECT packageDir
+ FROM wcf".WCF_N."_package
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
+ while ($row = $statement->fetchArray()) {
+ $packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
+ $this->readCacheFiles('data', $packageDir.'cache');
}
- }
- };
-
- // filesystem cache
- if ($this->cacheData['source'] == 'wcf\system\cache\source\DiskCacheSource') {
- // set version
- $this->cacheData['version'] = WCF_VERSION;
+ break;
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
+ case 'wcf\system\cache\source\ApcCacheSource':
+ // set version
+ $this->cacheData['version'] = phpversion('apc');
+
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
+ $conditions->add("isApplication = ?", array(1));
+
+ // get package dirs
+ $sql = "SELECT packageDir, packageName, instanceNo
+ FROM wcf".WCF_N."_package
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
+
+ $packageNames = array();
+ while ($row = $statement->fetchArray()) {
+ $packagePath = FileUtil::getRealPath(WCF_DIR.$row['packageDir']).'cache/';
+ $packageNames[$packagePath] = $row['packageName'].' #'.$row['instanceNo'];
+ }
+
+ $apcinfo = apc_cache_info('user');
+ $cacheList = $apcinfo['cache_list'];
+ foreach ($cacheList as $cache) {
+ $cachePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(dirname($cache['info'])));
+ if (isset($packageNames[$cachePath])) {
+ // 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['data'])) {
+ $this->caches['data'] = array();
+ }
+ if (!isset($this->caches['data'][$packageName])) {
+ $this->caches['data'][$packageName] = array();
+ }
+
+ // get additional cache information
+ $this->caches['data'][$packageName][] = array(
+ 'filename' => basename($cache['info'], '.php'),
+ 'filesize' => $cache['mem_size'],
+ 'mtime' => $cache['mtime'],
+ );
+
+ $this->cacheData['files']++;
+ $this->cacheData['size'] += $cache['mem_size'];
+ }
+ }
+ break;
- // get package dirs
- $sql = "SELECT packageDir
- FROM wcf".WCF_N."_package
- ".$conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
- $readFileCache($packageDir.'cache');
- }
+ case 'wcf\system\cache\source\NoCacheSource':
+ $this->cacheData['version'] = WCF_VERSION;
+ $this->cacheData['files'] = $this->cacheData['size'] = 0;
+ break;
}
- // memcache
- else if ($this->cacheData['source'] == 'wcf\system\cache\source\MemcacheCacheSource') {
- // get version
- $this->cacheData['version'] = MemcacheAdapter::getInstance()->getMemcache()->getVersion();
-
- // get stats
- $stats = MemcacheAdapter::getInstance()->getMemcache()->getStats();
- $this->cacheData['files'] = $stats['curr_items'];
- $this->cacheData['size'] = $stats['bytes'];
+
+ $this->readCacheFiles('language', WCF_DIR.'language');
+ $this->readCacheFiles('template', WCF_DIR.'templates/compiled', new Regex('\.meta\.php$'));
+ $this->readCacheFiles('template', WCF_DIR.'acp/templates/compiled', new Regex('\.meta\.php$'));
+ }
+
+ /**
+ * Reads the information of cached files
+ *
+ * @param string $cacheType
+ * @param strign $cacheDir
+ * @param wcf\system\Regex $ignore
+ */
+ protected function readCacheFiles($cacheType, $cacheDir, Regex $ignore = null) {
+ if (!isset($this->cacheData[$cacheType])) {
+ $this->cacheData[$cacheType] = array();
}
- // apc
- else if ($this->cacheData['source'] == 'wcf\system\cache\source\ApcCacheSource') {
- // set version
- $this->cacheData['version'] = phpversion('apc');
-
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
-
- // get package dirs
- $sql = "SELECT packageDir, packageName, instanceNo
- FROM wcf".WCF_N."_package
- ".$conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
-
- $packageNames = array();
- while ($row = $statement->fetchArray()) {
- $packagePath = FileUtil::getRealPath(WCF_DIR.$row['packageDir']).'cache/';
- $packageNames[$packagePath] = $row['packageName'].' #'.$row['instanceNo'];
- }
-
- $apcinfo = apc_cache_info('user');
- $cacheList = $apcinfo['cache_list'];
- foreach ($cacheList as $cache) {
- $cachePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(dirname($cache['info'])));
- if (isset($packageNames[$cachePath])) {
- // 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();
-
- // get additional cache information
- $this->caches[$packageName][] = array(
- 'filename' => basename($cache['info'], '.php'),
- 'filesize' => $cache['mem_size'],
- 'mtime' => $cache['mtime'],
- );
-
- $this->cacheData['files']++;
- $this->cacheData['size'] += $cache['mem_size'];
+
+ // get files in cache directory
+ try {
+ $directoryUtil = DirectoryUtil::getInstance($cacheDir);
+ }
+ catch (SystemException $e) {
+ return;
+ }
+
+ $files = $directoryUtil->getFileObjects(SORT_ASC, new Regex('\.php$'));
+
+ // get additional file information
+ $data = array();
+ if (is_array($files)) {
+ foreach ($files as $file) {
+ if ($ignore !== null && $ignore->match($file)) {
+ continue;
}
+
+ $data[] = array(
+ 'filename' => $file->getBasename(),
+ 'filesize' => $file->getSize(),
+ 'mtime' => $file->getMtime(),
+ 'perm' => substr(sprintf('%o', $file->getPerms()), -3),
+ 'writable' => $file->isWritable()
+ );
+
+ $this->cacheData['files']++;
+ $this->cacheData['size'] += $file->getSize();
}
}
- // disabled
- else if ($this->cacheData['source'] == 'wcf\system\cache\source\NoCacheSource') {
- $this->cacheData['version'] = WCF_VERSION;
- $this->cacheData['files'] = $this->cacheData['size'] = 0;
- }
- $readFileCache(WCF_DIR.'language');
- $readFileCache(WCF_DIR.'templates/compiled', new Regex('\.meta\.php$'));
- $readFileCache(WCF_DIR.'acp/templates/compiled', new Regex('\.meta\.php$'));
+ $this->caches[$cacheType][$cacheDir] = $data;
}
/**
<item name="wcf.acp"><![CDATA[Administration]]></item>
</category>
+ <category name="wcf.acp.cache">
+ <item name="wcf.acp.cache.button.clear"><![CDATA[Cache leeren]]></item>
+ <item name="wcf.acp.cache.clear.success"><![CDATA[Der Cache wurde erfolgreich geleert.]]></item>
+ <item name="wcf.acp.cache.clear.sure"><![CDATA[Wollen Sie den Cache wirklich komplett leeren?]]></item>
+ <item name="wcf.acp.cache.data"><![CDATA[Eigenschaften]]></item>
+ <item name="wcf.acp.cache.data.files"><![CDATA[Dateien]]></item>
+ <item name="wcf.acp.cache.data.files.count"><![CDATA[{#$files|count} Dateien]]></item>
+ <item name="wcf.acp.cache.data.size"><![CDATA[Größe]]></item>
+ <item name="wcf.acp.cache.data.source"><![CDATA[Quelle]]></item>
+ <item name="wcf.acp.cache.data.version"><![CDATA[Version]]></item>
+ <item name="wcf.acp.cache.list"><![CDATA[Cache]]></item>
+ <item name="wcf.acp.cache.list.mtime"><![CDATA[Letzte Aktualisierung]]></item>
+ <item name="wcf.acp.cache.list.name"><![CDATA[Name]]></item>
+ <item name="wcf.acp.cache.list.perm"><![CDATA[Zugriffsrechte]]></item>
+ <item name="wcf.acp.cache.list.size"><![CDATA[Größe]]></item>
+ <item name="wcf.acp.cache.source.type.ApcCacheSource"><![CDATA[Alternative PHP Cache]]></item>
+ <item name="wcf.acp.cache.source.type.DiskCacheSource"><![CDATA[Dateisystem]]></item>
+ <item name="wcf.acp.cache.source.type.MemcacheCacheSource"><![CDATA[Memcache]]></item>
+ <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.template"><![CDATA[Templates]]></item>
+ </category>
+
<category name="wcf.acp.cronjob">
<item name="wcf.acp.cronjob.list"><![CDATA[Cronjobs]]></item>
<item name="wcf.acp.cronjob.add"><![CDATA[Cronjob hinzufügen]]></item>
<item name="wcf.acp.group.option.category.user"><![CDATA[Allgemeine Rechte]]></item>
</category>
- <category name="wcf.acp.cache">
- <item name="wcf.acp.cache.button.clear"><![CDATA[Cache leeren]]></item>
- <item name="wcf.acp.cache.clear.success"><![CDATA[Der Cache wurde erfolgreich geleert.]]></item>
- <item name="wcf.acp.cache.clear.sure"><![CDATA[Wollen Sie den Cache wirklich komplett leeren?]]></item>
- <item name="wcf.acp.cache.data"><![CDATA[Eigenschaften]]></item>
- <item name="wcf.acp.cache.data.files"><![CDATA[Dateien]]></item>
- <item name="wcf.acp.cache.data.files.count"><![CDATA[{#$files|count} Dateien]]></item>
- <item name="wcf.acp.cache.data.size"><![CDATA[Größe]]></item>
- <item name="wcf.acp.cache.data.source"><![CDATA[Quelle]]></item>
- <item name="wcf.acp.cache.data.version"><![CDATA[Version]]></item>
- <item name="wcf.acp.cache.list"><![CDATA[Cache]]></item>
- <item name="wcf.acp.cache.list.mtime"><![CDATA[Letzte Aktualisierung]]></item>
- <item name="wcf.acp.cache.list.name"><![CDATA[Name]]></item>
- <item name="wcf.acp.cache.list.perm"><![CDATA[Zugriffsrechte]]></item>
- <item name="wcf.acp.cache.list.size"><![CDATA[Größe]]></item>
- </category>
-
<category name="wcf.acp.masterPassword">
<item name="wcf.acp.masterPassword"><![CDATA[Hauptkennwort]]></item>
<item name="wcf.acp.masterPassword.confirm"><![CDATA[Hauptkennwort wiederholen]]></item>
<item name="wcf.acp"><![CDATA[Administration]]></item>
</category>
+ <category name="wcf.acp.cache">
+ <item name="wcf.acp.cache.button.clear"><![CDATA[Empty cache]]></item>
+ <item name="wcf.acp.cache.clear.success"><![CDATA[The cache has been successfully emptied.]]></item>
+ <item name="wcf.acp.cache.clear.sure"><![CDATA[Are you sure that you want to empty the cache completely?]]></item>
+ <item name="wcf.acp.cache.data"><![CDATA[Settings]]></item>
+ <item name="wcf.acp.cache.data.files"><![CDATA[Files]]></item>
+ <item name="wcf.acp.cache.data.files.count"><![CDATA[{#$files|count} files]]></item>
+ <item name="wcf.acp.cache.data.size"><![CDATA[Size]]></item>
+ <item name="wcf.acp.cache.data.source"><![CDATA[Source]]></item>
+ <item name="wcf.acp.cache.data.version"><![CDATA[Version]]></item>
+ <item name="wcf.acp.cache.list"><![CDATA[Cache]]></item>
+ <item name="wcf.acp.cache.list.mtime"><![CDATA[Last updated]]></item>
+ <item name="wcf.acp.cache.list.name"><![CDATA[Name]]></item>
+ <item name="wcf.acp.cache.list.perm"><![CDATA[Permissions]]></item>
+ <item name="wcf.acp.cache.list.size"><![CDATA[Size]]></item>
+ <item name="wcf.acp.cache.source.type.ApcCacheSource"><![CDATA[Alternative PHP Cache]]></item>
+ <item name="wcf.acp.cache.source.type.DiskCacheSource"><![CDATA[File system]]></item>
+ <item name="wcf.acp.cache.source.type.MemcacheCacheSource"><![CDATA[Memcache]]></item>
+ <item name="wcf.acp.cache.source.type.NoCacheSource"><![CDATA[none (Caching disabled)]]></item>
+ <item name="wcf.acp.cache.type.data"><![CDATA[Data]]></item>
+ <item name="wcf.acp.cache.type.language"><![CDATA[Languages]]></item>
+ <item name="wcf.acp.cache.type.template"><![CDATA[Templates]]></item>
+ </category>
+
<category name="wcf.acp.cronjob">
<item name="wcf.acp.cronjob.list"><![CDATA[Cron jobs]]></item>
<item name="wcf.acp.cronjob.add"><![CDATA[Add a new cron job]]></item>
<item name="wcf.acp.group.option.category.user"><![CDATA[General permissions]]></item>
</category>
- <category name="wcf.acp.cache">
- <item name="wcf.acp.cache.button.clear"><![CDATA[Empty cache]]></item>
- <item name="wcf.acp.cache.clear.success"><![CDATA[The cache has been successfully emptied.]]></item>
- <item name="wcf.acp.cache.clear.sure"><![CDATA[Are you sure that you want to empty the cache completely?]]></item>
- <item name="wcf.acp.cache.data"><![CDATA[Settings]]></item>
- <item name="wcf.acp.cache.data.files"><![CDATA[Files]]></item>
- <item name="wcf.acp.cache.data.files.count"><![CDATA[{#$files|count} files]]></item>
- <item name="wcf.acp.cache.data.size"><![CDATA[Size]]></item>
- <item name="wcf.acp.cache.data.source"><![CDATA[Source]]></item>
- <item name="wcf.acp.cache.data.version"><![CDATA[Version]]></item>
- <item name="wcf.acp.cache.list"><![CDATA[Cache]]></item>
- <item name="wcf.acp.cache.list.mtime"><![CDATA[Last updated]]></item>
- <item name="wcf.acp.cache.list.name"><![CDATA[Name]]></item>
- <item name="wcf.acp.cache.list.perm"><![CDATA[Permissions]]></item>
- <item name="wcf.acp.cache.list.size"><![CDATA[Size]]></item>
- </category>
-
<category name="wcf.acp.masterPassword">
<item name="wcf.acp.masterPassword"><![CDATA[Master password]]></item>
<item name="wcf.acp.masterPassword.confirm"><![CDATA[Confirm master password]]></item>