request['mode'];
switch ($mode) {
case 'clear_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'] = '' . $lang['ALL_CACHE_CLEARED'] . '';
break;
case 'clear_datastore':
global $datastore;
$datastore->clean();
$this->response['datastore_html'] = '' . $lang['DATASTORE_CLEARED'] . '';
break;
case 'clear_template_cache':
global $template;
$match = XS_TPL_PREFIX;
$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'] = '' . $lang['ALL_TEMPLATE_CLEARED'] . '';
break;
case 'indexer':
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
if (!is_file($bb_cfg['sphinx_config_path'] . ".log")) {
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
foreach ($result as $row) {
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", $row . "\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
$this->response['indexer_html'] = '' . $lang['INDEXER'] . '';
break;
case 'update_user_level':
\TorrentPier\Legacy\Group::update_user_level('all');
$this->response['update_user_level_html'] = '' . $lang['USER_LEVELS_UPDATED'] . '';
break;
case 'sync_topics':
\TorrentPier\Legacy\Admin\Common::sync('topic', 'all');
\TorrentPier\Legacy\Admin\Common::sync_all_forums();
$this->response['sync_topics_html'] = '' . $lang['TOPICS_DATA_SYNCHRONIZED'] . '';
break;
case 'sync_user_posts':
\TorrentPier\Legacy\Admin\Common::sync('user_posts', 'all');
$this->response['sync_user_posts_html'] = '' . $lang['USER_POSTS_COUNT_SYNCHRONIZED'] . '';
break;
case 'unlock_cron':
\TorrentPier\Helpers\CronHelper::enableBoard();
$this->response['unlock_cron_html'] = '' . $lang['ADMIN_UNLOCKED'] . '';
break;
}
$this->response['mode'] = $mode;