diff --git a/controllers/class.ClearCache.php b/controllers/class.ClearCache.php
new file mode 100644
index 000000000..770abcdea
--- /dev/null
+++ b/controllers/class.ClearCache.php
@@ -0,0 +1,51 @@
+
+ * @copyright Copyright (C) 2010-2013 Uwe Steinmann
+ * @version Release: @package_version@
+ */
+
+/**
+ * Class which does the busines logic for clearing the cache
+ *
+ * @category DMS
+ * @package SeedDMS
+ * @author Uwe Steinmann
+ * @copyright Copyright (C) 2010-2013 Uwe Steinmann
+ * @version Release: @package_version@
+ */
+class SeedDMS_Controller_ClearCache extends SeedDMS_Controller_Common {
+
+ public function run() {
+ $dms = $this->params['dms'];
+ $user = $this->params['user'];
+ $settings = $this->params['settings'];
+ $post = $this->params['post'];
+
+ $ret = '';
+ if(!empty($post['preview'])) {
+ $cmd = 'rm -rf '.$settings->_cacheDir.'/[1-9]*';
+ system($cmd, $ret);
+ }
+
+ if(!empty($post['js'])) {
+ $cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
+ system($cmd, $ret);
+ }
+
+ if(false === $this->callHook('clear', $post)) {
+ if(empty($this->errormsg))
+ $this->errormsg = 'hook_clear_failed';
+ return false;
+ }
+
+ return true;
+ }
+}
+
diff --git a/op/op.ClearCache.php b/op/op.ClearCache.php
index 921bb713f..77dfcb2ed 100644
--- a/op/op.ClearCache.php
+++ b/op/op.ClearCache.php
@@ -24,8 +24,12 @@ include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php");
+include("../inc/inc.ClassController.php");
include("../inc/inc.Authentication.php");
+$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
+$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
+
/* Check if the form data comes from a trusted request */
if(!checkFormKey('clearcache')) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
@@ -38,19 +42,8 @@ if(!is_dir($settings->_cacheDir)) {
UI::exitError(getMLText("admin_tools"),getMLText("error_cleared_cache"));
}
-if(!empty($_POST['preview'])) {
- $cmd = 'rm -rf '.$settings->_cacheDir.'/[1-9]*';
- $ret = null;
- system($cmd, $ret);
-}
-
-if(!empty($_POST['js'])) {
- $cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
- $ret = null;
- system($cmd, $ret);
-}
-
-if($ret)
+$controller->setParam('post', $_POST);
+if(!$controller->run())
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache')));
else
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache')));
diff --git a/views/bootstrap/class.ClearCache.php b/views/bootstrap/class.ClearCache.php
index 1d562d507..c925c04a9 100644
--- a/views/bootstrap/class.ClearCache.php
+++ b/views/bootstrap/class.ClearCache.php
@@ -54,6 +54,13 @@ class SeedDMS_View_ClearCache extends SeedDMS_Bootstrap_Style {
+callHook('additionalCache', $addcache)) {
+ foreach($addcache as $c)
+ echo "
".$c[1]."
";
+ }
+?>