add new operation to clear cache completely

This commit is contained in:
Uwe Steinmann 2016-04-28 07:51:42 +02:00
parent 42c68e0b1e
commit 5d25720ec9
5 changed files with 138 additions and 0 deletions

View File

@ -2,6 +2,7 @@
Changes in version 4.3.27
--------------------------------------------------------------------------------
- remove preview images when document or document content is removed (Closes #262)
- add clear cache operation in admin tools
--------------------------------------------------------------------------------
Changes in version 4.3.26

36
op/op.ClearCache.php Normal file
View File

@ -0,0 +1,36 @@
<?php
// SeedDMS. Document Management System
// Copyright (C) 2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php");
/* Check if the form data comes for a trusted request */
if(!checkFormKey('clearcache')) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
}
$cmd = 'rm -rf '.$settings->_cacheDir.'/*';
system($cmd);
add_log_line("");
header("Location:../out/out.AdminTools.php");

40
out/out.ClearCache.php Normal file
View File

@ -0,0 +1,40 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Version.php");
include("../inc/inc.Settings.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php");
if (!$user->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) {
$view->setParam('cachedir', $settings->_cacheDir);
$view($_GET);
exit;
}
?>

View File

@ -573,6 +573,7 @@ $(document).ready(function () {
echo " <li><a href=\"../out/out.Charts.php\">".getMLText("charts")."</a></li>\n";
echo " <li><a href=\"../out/out.Timeline.php\">".getMLText("timeline")."</a></li>\n";
echo " <li><a href=\"../out/out.ObjectCheck.php\">".getMLText("objectcheck")."</a></li>\n";
echo " <li><a href=\"../out/out.ClearCache.php\">".getMLText("clear_cache")."</a></li>\n";
echo " <li><a href=\"../out/out.Info.php\">".getMLText("version_info")."</a></li>\n";
echo " </ul>\n";
echo " </li>\n";

View File

@ -0,0 +1,60 @@
<?php
/**
* Implementation of ClearCache view
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for ClearCache view
*
* @category DMS
* @package SeedDMS
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_ClearCache extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$cachedir = $this->params['cachedir'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("clear_cache"));
$this->contentContainerStart('warning');
?>
<form action="../op/op.ClearCache.php" name="form1" method="post">
<?php echo createHiddenFieldWithKey('clearcache'); ?>
<p>
<?php printMLText("confirm_clear_cache", array('cache_dir'=>$cachedir));?>
</p>
<p><button type="submit" class="btn"><i class="icon-remove"></i> <?php printMLText("clear_cache");?></button></p>
</form>
<?php
$this->contentContainerEnd();
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */
}
?>