mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
calc and diѕplay disc usage and number of files in cache
This commit is contained in:
parent
c2a4c76f3f
commit
3e47e80874
|
@ -31,6 +31,10 @@
|
|||
*/
|
||||
class SeedDMS_View_ClearCache extends SeedDMS_Theme_Style {
|
||||
|
||||
protected function output($name, $title, $space, $c) {
|
||||
echo '<p><input type="checkbox" name="'.$name.'" value="1" checked> '.$title.($space !== NULL || $c != NULL ? '<br />' : '').($space !== NULL ? SeedDMS_Core_File::format_filesize($space) : '').($c !== NULL ? ' in '.$c.' Files' : '').'</p>';
|
||||
}
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -48,24 +52,48 @@ class SeedDMS_View_ClearCache extends SeedDMS_Theme_Style {
|
|||
<?php
|
||||
$this->contentContainerStart('warning');
|
||||
?>
|
||||
<p>
|
||||
<input type="checkbox" name="previewpng" value="1" checked> <?php printMLText('preview_images'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="previewpdf" value="1" checked> <?php printMLText('preview_pdf'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="previewtxt" value="1" checked> <?php printMLText('preview_text'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="js" value="1" checked> <?php printMLText('temp_jscode'); ?>
|
||||
<?php
|
||||
$totalc = 0;
|
||||
$totalspace = 0;
|
||||
// Preview for png, pdf, and txt */
|
||||
foreach(['png', 'pdf', 'txt'] as $t) {
|
||||
$path = addDirSep($cachedir).$t;
|
||||
if(file_exists($path)) {
|
||||
$space = dskspace($path);
|
||||
$fi = new FilesystemIterator($path, FilesystemIterator::SKIP_DOTS);
|
||||
$c = iterator_count($fi);
|
||||
} else {
|
||||
$space = $c = 0;
|
||||
}
|
||||
$totalc += $c;
|
||||
$totalspace += $space;
|
||||
$this->output('preview', getMLText('preview_'.$t), $space, $c);
|
||||
}
|
||||
|
||||
/* Javascript */
|
||||
$path = addDirSep($cachedir).'js';
|
||||
if(file_exists($path)) {
|
||||
$space = dskspace($path);
|
||||
$fi = new FilesystemIterator($path, FilesystemIterator::SKIP_DOTS);
|
||||
$c = iterator_count($fi);
|
||||
} else {
|
||||
$space = $c = 0;
|
||||
}
|
||||
$totalc += $c;
|
||||
$totalspace += $space;
|
||||
$this->output('js', getMLText('temp_jscode'), $space, $c);
|
||||
|
||||
/* Cache dirѕ added by extensions */
|
||||
$addcache = array();
|
||||
if($addcache = $this->callHook('additionalCache')) {
|
||||
foreach($addcache as $c)
|
||||
echo "<p><input type=\"checkbox\" name=\"".$c[0]."\" value=\"1\" checked> ".$c[1].(isset($c[2])||isset($c[3]) ? "<br/>" : '').(isset($c[2]) ? SeedDMS_Core_File::format_filesize($c[2]) : '').(isset($c[3]) ? ' in '.$c[3]." Files" : '')."</p>";
|
||||
foreach($addcache as $c) {
|
||||
$this->output($c[0], $c[1], isset($c[2]) ? $c[2] : NULL, isset($c[3]) ? $c[3] : NULL);
|
||||
$totalc += $c[3];
|
||||
$totalspace += $c[2];
|
||||
}
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
$this->infoMsg(SeedDMS_Core_File::format_filesize($totalspace).' in '.$totalc.' Files');
|
||||
$this->formSubmit("<i class=\"fa fa-remove\"></i> ".getMLText('clear_cache'), '', '', 'danger');
|
||||
?>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue
Block a user