-{include file='header'}\r
-\r
-<div class="mainHeadline">\r
- <img src="{@RELATIVE_WCF_DIR}icon/cacheL.png" alt="" />\r
- <div class="headlineContainer">\r
- <h2>{lang}wcf.acp.cache.list{/lang}</h2>\r
- </div>\r
-</div>\r
-\r
-{if $cleared}\r
- <p class="success">{lang}wcf.acp.cache.clear.success{/lang}</p> \r
-{/if}\r
-\r
-<fieldset>\r
- <legend>{lang}wcf.acp.cache.data{/lang}</legend>\r
- \r
- <div class="formElement">\r
- <p class="formFieldLabel">{lang}wcf.acp.cache.data.source{/lang}</p>\r
- <p class="formField">{$cacheData.source}</p>\r
- </div>\r
- {if $cacheData.version}\r
- <div class="formElement">\r
- <p class="formFieldLabel">{lang}wcf.acp.cache.data.version{/lang}</p>\r
- <p class="formField">{$cacheData.version}</p>\r
- </div>\r
- {/if}\r
- <div class="formElement">\r
- <p class="formFieldLabel">{lang}wcf.acp.cache.data.size{/lang}</p>\r
- <p class="formField">{@$cacheData.size|filesize}</p>\r
- </div>\r
- <div class="formElement">\r
- <p class="formFieldLabel">{lang}wcf.acp.cache.data.files{/lang}</p>\r
- <p class="formField">{#$cacheData.files}</p>\r
- </div>\r
- \r
- {if $additionalFields|isset}{@$additionalFields}{/if}\r
-</fieldset>\r
-\r
-<div class="contentHeader">\r
- <div class="largeButtons">\r
- <ul>\r
- <li><a onclick="return confirm('{lang}wcf.acp.cache.clear.sure{/lang}')" href="index.php?action=CacheClear{@SID_ARG_2ND}"><img src="{@RELATIVE_WCF_DIR}icon/deleteM.png" alt="" /> <span>{lang}wcf.acp.cache.button.clear{/lang}</span></a></li>\r
- {if $additionalLargeButtons|isset}{@$additionalLargeButtons}{/if}\r
- </ul>\r
- </div>\r
-</div>\r
-\r
-{foreach from=$caches key=cache item=files}\r
- {if $files|count}\r
- <div class="border titleBarPanel">\r
- <div class="containerHead">\r
- <div class="containerIcon">\r
- <a onclick="openList('{$cache}')"><img src="{@RELATIVE_WCF_DIR}icon/minusS.png" id="{$cache}Image" alt="" /></a>\r
- </div>\r
- <div class="containerContent">\r
- <h3>{$cache} ({#$files|count})</h3>\r
- </div>\r
- </div>\r
- </div>\r
- <div class="border borderMarginRemove" id="{$cache}">\r
- <table class="tableList">\r
- <thead>\r
- <tr class="tableHead">\r
- <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.name{/lang}</span></div></th>\r
- <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.size{/lang}</span></div></th>\r
- <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.mtime{/lang}</span></div></th>\r
- <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.perm{/lang}</span></div></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- {foreach from=$files item=file}\r
- <tr class="{cycle values="container-1,container-2"}">\r
- <td class="columnText">{$file.filename}</td>\r
- <td class="columnNumbers">{@$file.filesize|filesize}</td>\r
- <td class="columnDate">{if $file.mtime > 1}{@$file.mtime|time}{/if}</td>\r
- <td class="columnNumbers"{if !$file.writable} style="color: #c00"{/if}>{@$file.perm}</td>\r
- </tr>\r
- {/foreach}\r
- </tbody>\r
- </table>\r
- </div>\r
- <script type="text/javascript">\r
- //<![CDATA[\r
- initList('{$cache}', 0);\r
- //]]>\r
- </script>\r
- {/if}\r
-{/foreach}\r
-\r
-{include file='footer'}\r
+{include file='header'}
+
+<div class="mainHeadline">
+ <img src="{@RELATIVE_WCF_DIR}icon/cacheL.png" alt="" />
+ <div class="headlineContainer">
+ <h2>{lang}wcf.acp.cache.list{/lang}</h2>
+ </div>
+</div>
+
+{if $cleared}
+ <p class="success">{lang}wcf.acp.cache.clear.success{/lang}</p>
+{/if}
+
+<fieldset>
+ <legend>{lang}wcf.acp.cache.data{/lang}</legend>
+
+ <div class="formElement">
+ <p class="formFieldLabel">{lang}wcf.acp.cache.data.source{/lang}</p>
+ <p class="formField">{$cacheData.source}</p>
+ </div>
+ {if $cacheData.version}
+ <div class="formElement">
+ <p class="formFieldLabel">{lang}wcf.acp.cache.data.version{/lang}</p>
+ <p class="formField">{$cacheData.version}</p>
+ </div>
+ {/if}
+ <div class="formElement">
+ <p class="formFieldLabel">{lang}wcf.acp.cache.data.size{/lang}</p>
+ <p class="formField">{@$cacheData.size|filesize}</p>
+ </div>
+ <div class="formElement">
+ <p class="formFieldLabel">{lang}wcf.acp.cache.data.files{/lang}</p>
+ <p class="formField">{#$cacheData.files}</p>
+ </div>
+
+ {if $additionalFields|isset}{@$additionalFields}{/if}
+</fieldset>
+
+<div class="contentHeader">
+ <div class="largeButtons">
+ <ul>
+ <li><a onclick="return confirm('{lang}wcf.acp.cache.clear.sure{/lang}')" href="index.php?action=CacheClear{@SID_ARG_2ND}"><img src="{@RELATIVE_WCF_DIR}icon/deleteM.png" alt="" /> <span>{lang}wcf.acp.cache.button.clear{/lang}</span></a></li>
+ {if $additionalLargeButtons|isset}{@$additionalLargeButtons}{/if}
+ </ul>
+ </div>
+</div>
+
+{foreach from=$caches key=cache item=files}
+ {if $files|count}
+ <div class="border titleBarPanel">
+ <div class="containerHead">
+ <div class="containerIcon">
+ <a onclick="openList('{$cache}')"><img src="{@RELATIVE_WCF_DIR}icon/minusS.png" id="{$cache}Image" alt="" /></a>
+ </div>
+ <div class="containerContent">
+ <h3>{$cache} ({#$files|count})</h3>
+ </div>
+ </div>
+ </div>
+ <div class="border borderMarginRemove" id="{$cache}">
+ <table class="tableList">
+ <thead>
+ <tr class="tableHead">
+ <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.name{/lang}</span></div></th>
+ <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.size{/lang}</span></div></th>
+ <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.mtime{/lang}</span></div></th>
+ {if $files.0.perm|isset}
+ <th><div><span class="emptyHead">{lang}wcf.acp.cache.list.perm{/lang}</span></div></th>
+ {/if}
+ </tr>
+ </thead>
+ <tbody>
+ {foreach from=$files item=file}
+ <tr class="{cycle values="container-1,container-2"}">
+ <td class="columnText">{$file.filename}</td>
+ <td class="columnNumbers">{@$file.filesize|filesize}</td>
+ <td class="columnDate">{if $file.mtime > 1}{@$file.mtime|time}{/if}</td>
+ {if $file.perm|isset}
+ <td class="columnNumbers"{if !$file.writable} style="color: #c00"{/if}>{@$file.perm}</td>
+ {/if}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ initList('{$cache}', 0);
+ //]]>
+ </script>
+ {/if}
+{/foreach}
+
+{include file='footer'}
$this->cacheData['files'] = $stats['curr_items'];
$this->cacheData['size'] = $stats['bytes'];
}
+ // 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::getDependencies()));
+ $conditions->add("standalone = ?", 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());
+ $pattern = array();
+ $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 pacakgeName + 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'];
+ }
+ }
+ }
}
/**