check if preview and/or js cache is to be cleared

This commit is contained in:
Uwe Steinmann 2017-01-09 10:56:32 +01:00
parent 31e2eaccb0
commit 60dd7f8516

View File

@ -28,13 +28,22 @@ if(!checkFormKey('clearcache')) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token")); UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token"));
} }
$cmd = 'rm -rf '.$settings->_cacheDir.'/*'; if(!empty($_POST['preview'])) {
$ret = null; $cmd = 'rm -rf '.$settings->_cacheDir.'/[1-9]*';
system($cmd, $ret); $ret = null;
system($cmd, $ret);
}
if(!empty($_POST['js'])) {
$cmd = 'rm -rf '.$settings->_cacheDir.'/js/*';
$ret = null;
system($cmd, $ret);
}
if($ret) if($ret)
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_clearcache'))); $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache')));
else else
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_clearcache'))); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache')));
add_log_line(""); add_log_line("");