mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 21:16:07 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
2b0d45c68c
|
@ -30,22 +30,22 @@ class SeedDMS_Controller_ClearCache extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
$ret = '';
|
$ret = '';
|
||||||
if(!empty($post['previewpng'])) {
|
if(!empty($post['previewpng'])) {
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/png/[1-9]*';
|
$cmd = 'rm -rf '.addDirSep($settings->_cacheDir).'png'.DIRECTORY_SEPARATOR.'[1-9]*';
|
||||||
system($cmd, $ret);
|
system($cmd, $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($post['previewpdf'])) {
|
if(!empty($post['previewpdf'])) {
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/pdf/[1-9]*';
|
$cmd = 'rm -rf '.addDirSep($settings->_cacheDir).'pdf'.DIRECTORY_SEPARATOR.'[1-9]*';
|
||||||
system($cmd, $ret);
|
system($cmd, $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($post['previewtxt'])) {
|
if(!empty($post['previewtxt'])) {
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/txt/[1-9]*';
|
$cmd = 'rm -rf '.addDirSep($settings->_cacheDir).'txt'.DIRECTORY_SEPARATOR.'[1-9]*';
|
||||||
system($cmd, $ret);
|
system($cmd, $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($post['js'])) {
|
if(!empty($post['js'])) {
|
||||||
$cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
|
$cmd = 'rm -rf '.addDirSep($settings->_cacheDir).'js'.DIRECTORY_SEPARATOR.'*';
|
||||||
system($cmd, $ret);
|
system($cmd, $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
*/
|
*/
|
||||||
class SeedDMS_View_ClearCache extends SeedDMS_Theme_Style {
|
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() { /* {{{ */
|
function show() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
|
@ -48,24 +52,48 @@ class SeedDMS_View_ClearCache extends SeedDMS_Theme_Style {
|
||||||
<?php
|
<?php
|
||||||
$this->contentContainerStart('warning');
|
$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
|
<?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();
|
$addcache = array();
|
||||||
if($addcache = $this->callHook('additionalCache')) {
|
if($addcache = $this->callHook('additionalCache')) {
|
||||||
foreach($addcache as $c)
|
foreach($addcache as $c) {
|
||||||
echo "<p><input type=\"checkbox\" name=\"".$c[0]."\" value=\"1\" checked> ".$c[1]."</p>";
|
$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->contentContainerEnd();
|
||||||
|
$this->infoMsg(SeedDMS_Core_File::format_filesize($totalspace).' in '.$totalc.' Files');
|
||||||
$this->formSubmit("<i class=\"fa fa-remove\"></i> ".getMLText('clear_cache'), '', '', 'danger');
|
$this->formSubmit("<i class=\"fa fa-remove\"></i> ".getMLText('clear_cache'), '', '', 'danger');
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user