Revert "Added clear logs option in admin panel (#775)"

This reverts commit 88cf205962.
This commit is contained in:
Roman Kelesidis 2023-06-05 18:57:24 +07:00
commit 9d5fd03a45
4 changed files with 24 additions and 51 deletions

View file

@ -211,22 +211,6 @@ function bb_log($msg, $file_name, $return_path = false)
return file_write($msg, $path);
}
/**
* Remove files recursively by extension
*
* @param string $path
* @param array $findExtension
* @return void
*/
function remove_files_by_extension(string $path, array $findExtension)
{
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $file) {
if (in_array(pathinfo($file, PATHINFO_EXTENSION), $findExtension) && is_file($file)) {
unlink($file);
}
}
}
function file_write($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $replace_content = false)
{
$bytes_written = false;

View file

@ -16,12 +16,6 @@ global $userdata, $lang, $bb_cfg;
$mode = (string)$this->request['mode'];
switch ($mode) {
case 'clear_logs':
remove_files_by_extension(LOG_DIR, ['log']);
$this->response['logs_html'] = '<span class="seed bold">' . $lang['ALL_LOGS_FILE_CLEARED'] . '</span>';
break;
case 'clear_cache':
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
if (!in_array('db_sqlite', $cache_val)) {

View file

@ -101,7 +101,6 @@ $lang['CLICK_RETURN_GROUP'] = 'Click %sHere%s to return to group information';
$lang['ADMIN_PANEL'] = 'Go to Administration Panel';
$lang['ALL_CACHE_CLEARED'] = 'Cache has been cleared';
$lang['ALL_LOGS_FILE_CLEARED'] = 'Log files has been removed';
$lang['ALL_TEMPLATE_CLEARED'] = 'Template cache has been cleared';
$lang['DATASTORE_CLEARED'] = 'Datastore has been cleared';
$lang['BOARD_DISABLE'] = 'Sorry, this forum is disabled. Try to come back later';
@ -1646,8 +1645,7 @@ $lang['NOT_AVAILABLE'] = 'Not available';
// Clear Cache
$lang['DATASTORE'] = 'Datastore';
$lang['CLEAR_CACHE'] = 'Cache';
$lang['CLEAR_LOGS'] = 'Log files';
$lang['CLEAR_CACHE'] = 'Clear Cache';
$lang['CLEAR_TEMPLATES_CACHE'] = 'Templates cache';
// Update

View file

@ -65,24 +65,23 @@
<!-- IF TPL_ADMIN_MAIN -->
<!--========================================================================-->
<script type="text/javascript">
ajax.manage_admin = function (mode) {
ajax.exec({
action: 'manage_admin',
mode: mode,
user_id: ''
});
};
ajax.callback.manage_admin = function (data) {
$('#cache').html(data.cache_html);
$('#datastore').html(data.datastore_html);
$('#logs').html(data.logs_html);
$('#indexer').html(data.indexer_html);
$('#template_cache').html(data.template_cache_html);
$('#update_user_level').html(data.update_user_level_html);
$('#sync_topics').html(data.sync_topics_html);
$('#sync_user_posts').html(data.sync_user_posts_html);
$('#unlock_cron').html(data.unlock_cron_html);
}
ajax.manage_admin = function (mode) {
ajax.exec({
action: 'manage_admin',
mode: mode,
user_id: ''
});
};
ajax.callback.manage_admin = function (data) {
$('#cache').html(data.cache_html);
$('#datastore').html(data.datastore_html);
$('#indexer').html(data.indexer_html);
$('#template_cache').html(data.template_cache_html);
$('#update_user_level').html(data.update_user_level_html);
$('#sync_topics').html(data.sync_topics_html);
$('#sync_user_posts').html(data.sync_user_posts_html);
$('#unlock_cron').html(data.unlock_cron_html);
}
</script>
<br/>
@ -107,14 +106,12 @@
<table>
<tr>
<td><b>{L_CLEAR}:</b></td>
<td>
<a href="#" id="datastore" onclick="ajax.manage_admin('clear_datastore'); return false;">{L_DATASTORE}</a>&nbsp;&middot;
<a href="#" id="cache" onclick="ajax.manage_admin('clear_cache'); return false;">{L_CLEAR_CACHE}</a>&nbsp;&middot;
<a href="#" id="template_cache"
onclick="ajax.manage_admin('clear_template_cache'); return false;">{L_CLEAR_TEMPLATES_CACHE}</a>&nbsp;&middot;
<a href="#" id="logs" onclick="ajax.manage_admin('clear_logs'); return false;">{L_CLEAR_LOGS}</a>
</td>
<td><b>{L_CLEAR}:</b></td>
<td>
<a href="#" id="datastore" onclick="ajax.manage_admin('clear_datastore'); return false;">{L_DATASTORE}</a>&nbsp;&middot;
<a href="#" id="cache" onclick="ajax.manage_admin('clear_cache'); return false;">{L_CLEAR_CACHE}</a>&nbsp;&middot;
<a href="#" id="template_cache" onclick="ajax.manage_admin('clear_template_cache'); return false;">{L_CLEAR_TEMPLATES_CACHE}</a>
</td>
</tr>
<tr>
<td><b>{L_UPDATE}:</b></td>