Revert "Misc code improvements"

This reverts commit b479068bf3.
This commit is contained in:
Roman Kelesidis 2023-02-17 23:31:23 +07:00
commit dcb3b6f596
2 changed files with 20 additions and 53 deletions

View file

@ -18,7 +18,11 @@ $mode = (string)$this->request['mode'];
switch ($mode) {
case 'clear_cache':
clean_cache();
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
if (!in_array('db_sqlite', $cache_val)) {
CACHE($cache_name)->rm();
}
}
$this->response['cache_html'] = '<span class="seed bold">' . $lang['ALL_CACHE_CLEARED'] . '</span>';
@ -26,7 +30,9 @@ switch ($mode) {
case 'clear_datastore':
clean_datastore();
global $datastore;
$datastore->clean();
$this->response['datastore_html'] = '<span class="seed bold">' . $lang['DATASTORE_CLEARED'] . '</span>';
@ -34,7 +40,18 @@ switch ($mode) {
case 'clear_template_cache':
clean_tpl_cache();
global $template;
$match = 'tpl_';
$match_len = strlen($match);
$dir = $template->cachedir;
$res = @opendir($dir);
while (($file = readdir($res)) !== false) {
if (0 === strpos($file, $match)) {
@unlink($dir . $file);
}
}
closedir($res);
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';