* "Clear cache" option in admin panel cleans now signatures and twig too

This commit is contained in:
slawkens 2019-04-13 03:18:53 +02:00
parent 6a167e99dc
commit c87100c0fe

View File

@ -10,15 +10,14 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Dashboard';
$cache = Cache::getInstance();
if ($cache->enabled()) {
if (isset($_GET['clear_cache'])) {
if (clearCache())
if (isset($_GET['clear_cache'])) {
if (clearCache()) {
success('Cache cleared.');
else
} else {
error('Error while clearing cache.');
}
}
if (isset($_GET['maintenance'])) {
$_status = (int)$_POST['status'];
$message = $_POST['message'];
@ -73,8 +72,7 @@ $twig->display('admin.dashboard.html.twig', array(
'is_closed' => $is_closed,
'closed_message' => $closed_message,
'status' => $status,
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
));
echo '<div class="row">';
@ -96,7 +94,9 @@ function clearCache()
global $template_name;
$cache = Cache::getInstance();
if($cache->enabled()) {
$tmp = '';
if ($cache->fetch('status', $tmp))
$cache->delete('status');
@ -132,6 +132,11 @@ function clearCache()
if ($cache->fetch('template_ini' . $template_name, $tmp))
$cache->delete('template_ini' . $template_name);
}
deleteDirectory(CACHE . 'signatures', array('.htaccess'), true);
deleteDirectory(CACHE . 'twig', array('.htaccess'), true);
deleteDirectory(CACHE, array('signatures', 'twig', '.htaccess'), true);
return true;
}