mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
- added a few missing log variables
- include acp/common.php language file if displaying logs (LOG_ variables should be stored there only now) - added check to cron.php - added database_gc config variable - recalculate binary trees every once a week ;) git-svn-id: file:///svn/phpbb/trunk@5929 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* @copyright (c) 2005 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
* @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@@ -76,8 +76,6 @@ class acp_forums
|
||||
$auth->acl_clear_prefetch();
|
||||
$cache->destroy('sql', FORUMS_TABLE);
|
||||
|
||||
recalc_btree('forum_id', FORUMS_TABLE);
|
||||
|
||||
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
|
||||
|
||||
break;
|
||||
@@ -223,8 +221,6 @@ class acp_forums
|
||||
$auth->acl_clear_prefetch();
|
||||
$cache->destroy('sql', FORUMS_TABLE);
|
||||
|
||||
recalc_btree('forum_id', FORUMS_TABLE);
|
||||
|
||||
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'] . '&select_all_groups=1';
|
||||
|
||||
// Redirect to permissions
|
||||
|
@@ -208,8 +208,6 @@ class acp_modules
|
||||
|
||||
add_log('admin', 'LOG_MODULE_' . strtoupper($action), $move_module_name);
|
||||
|
||||
// recalculate binary tree
|
||||
recalc_btree('module_id', MODULES_TABLE, $this->module_class);
|
||||
$this->remove_cache_file();
|
||||
|
||||
break;
|
||||
@@ -247,8 +245,6 @@ class acp_modules
|
||||
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
// recalculate binary tree
|
||||
recalc_btree('module_id', MODULES_TABLE, $this->module_class);
|
||||
$this->remove_cache_file();
|
||||
|
||||
trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&parent_id=' . $parent_id));
|
||||
@@ -337,8 +333,6 @@ class acp_modules
|
||||
|
||||
if (!sizeof($errors))
|
||||
{
|
||||
// recalculate binary tree
|
||||
recalc_btree('module_id', MODULES_TABLE, $this->module_class);
|
||||
$this->remove_cache_file();
|
||||
|
||||
trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&parent_id=' . $parent_id));
|
||||
|
@@ -2716,28 +2716,25 @@ function page_footer()
|
||||
// Tidy the cache
|
||||
$cron_type = 'tidy_cache';
|
||||
}
|
||||
else if (time() - $config['warnings_last_gc'] > $config['warnings_gc'])
|
||||
else if (time() - $config['warnings_gc'] > $config['warnings_last_gc'])
|
||||
{
|
||||
$cron_type = 'tidy_warnings';
|
||||
}
|
||||
else if (time() - (7 * 24 * 3600) > $config['database_last_gc'])
|
||||
else if (time() - $config['database_gc'] > $config['database_last_gc'])
|
||||
{
|
||||
// Tidy some table rows every week
|
||||
// Tidy the database
|
||||
// This includes recalculation binary trees, ...
|
||||
$cron_type = 'tidy_database';
|
||||
}
|
||||
else if (time() - $config['search_last_gc'] > $config['search_gc'])
|
||||
else if (time() - $config['search_gc'] > $config['search_last_gc'])
|
||||
{
|
||||
// Tidy the search
|
||||
$cron_type = 'tidy_search';
|
||||
}
|
||||
/**
|
||||
* @todo add session garbage collection
|
||||
|
||||
else if (time() - $config['session_gc'] > $config['session_last_gc'])
|
||||
{
|
||||
$cron_type = 'tidy_sessions';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($cron_type)
|
||||
{
|
||||
|
@@ -178,6 +178,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
|
||||
|
||||
$iteration++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
unset($padding_store);
|
||||
|
||||
return $forum_list;
|
||||
@@ -2264,27 +2265,31 @@ function tidy_warnings()
|
||||
$db->sql_transaction('commit');
|
||||
}
|
||||
|
||||
set_config('warnings_last_gc', time());
|
||||
set_config('warnings_last_gc', time(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy database
|
||||
* Removes all tracking rows older than 6 months, including mark_posted informations
|
||||
* Tidy database, doing some maintanance tasks
|
||||
*/
|
||||
function tidy_database()
|
||||
{
|
||||
global $db;
|
||||
/*
|
||||
$remove_date = time() - (3 * 62 * 24 * 3600);
|
||||
|
||||
$sql = 'DELETE FROM ' . FORUMS_TRACK_TABLE . '
|
||||
WHERE mark_time < ' . $remove_date;
|
||||
$db->sql_query($sql);
|
||||
// Recalculate binary tree for forums
|
||||
recalc_btree('forum_id', FORUMS_TABLE);
|
||||
|
||||
// Recalculate binary tree for modules
|
||||
$sql = 'SELECT module_class
|
||||
FROM ' . MODULES_TABLE . '
|
||||
GROUP BY module_class';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
recalc_btree('module_id', MODULES_TABLE, $row['module_class']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
|
||||
WHERE mark_time < ' . $remove_date;
|
||||
$db->sql_query($sql);
|
||||
*/
|
||||
set_config('database_last_gc', time(), true);
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,8 @@ class mcp_logs
|
||||
global $auth, $db, $user, $template;
|
||||
global $config, $phpbb_root_path, $phpEx, $SID;
|
||||
|
||||
$user->add_lang('acp/common');
|
||||
|
||||
$action = request_var('action', array('' => ''));
|
||||
|
||||
if (is_array($action))
|
||||
|
@@ -45,11 +45,14 @@ class mcp_notes
|
||||
);
|
||||
|
||||
$this->tpl_name = 'mcp_notes_front';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'user_notes':
|
||||
$user->add_lang('acp/common');
|
||||
|
||||
mcp_notes_user_view($id, $mode, $action);
|
||||
$this->tpl_name = 'mcp_notes_user';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -615,6 +615,8 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
// destroy too old cached search results
|
||||
$this->destroy_cache(array());
|
||||
|
||||
set_config('search_last_gc', time(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -910,6 +910,7 @@ class fulltext_native extends search_backend
|
||||
// carry on ... it's okay ... I know when I'm not wanted boo hoo
|
||||
if (!$config['fulltext_native_load_upd'])
|
||||
{
|
||||
set_config('search_last_gc', time(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -978,6 +979,8 @@ class fulltext_native extends search_backend
|
||||
|
||||
// destroy cached search results containing any of the words that are now common or were removed
|
||||
$this->destroy_cache(array_unique($destroy_cache_words));
|
||||
|
||||
set_config('search_last_gc', time(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -270,12 +270,12 @@ class session
|
||||
|
||||
$this->data = array();
|
||||
|
||||
// Garbage collection ... remove old sessions updating user information
|
||||
/* Garbage collection ... remove old sessions updating user information
|
||||
// if necessary. It means (potentially) 11 queries but only infrequently
|
||||
if ($this->time_now > $config['session_last_gc'] + $config['session_gc'])
|
||||
{
|
||||
$this->session_gc();
|
||||
}
|
||||
}*/
|
||||
|
||||
// Do we allow autologin on this board? No? Then override anything
|
||||
// that may be requested here
|
||||
@@ -674,7 +674,7 @@ class session
|
||||
{
|
||||
// Less than 5 sessions, update gc timer ... else we want gc
|
||||
// called again to delete other sessions
|
||||
set_config('session_last_gc', $this->time_now);
|
||||
set_config('session_last_gc', $this->time_now, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user