diff --git a/phpBB/cron.php b/phpBB/cron.php
index 4a23143a2d..c40b0cdac5 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -14,23 +14,27 @@ define('IN_PHPBB', true);
define('IN_CRON', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
-include($phpbb_root_path . 'common.'.$phpEx);
+include($phpbb_root_path . 'common.' . $phpEx);
$cron_type = request_var('cron_type', '');
-
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;
/**
* Run cron-like action
* Real cron-based layer will be introduced in 3.2
-*
-* @todo check gc-intervals here too (important!)
*/
switch ($cron_type)
{
case 'queue':
- include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
+
+ if (time() - $config['queue_interval'] <= $config['last_queue_run'] || !file_exists($phpbb_root_path . 'cache/queue.' . $phpEx))
+ {
+ break;
+ }
+
+ include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$queue = new queue();
+
if ($use_shutdown_function)
{
register_shutdown_function(array(&$queue, 'process'));
@@ -39,9 +43,16 @@ switch ($cron_type)
{
$queue->process();
}
+
break;
case 'tidy_cache':
+
+ if (time() - $config['cache_gc'] <= $config['cache_last_gc'] || !method_exists($cache, 'tidy'))
+ {
+ break;
+ }
+
if ($use_shutdown_function)
{
register_shutdown_function(array(&$cache, 'tidy'));
@@ -50,16 +61,19 @@ switch ($cron_type)
{
$cache->tidy();
}
+
break;
case 'tidy_search':
+
// Select the search method
- $search_type = $config['search_type'];
+ $search_type = basename($config['search_type']);
- if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx) || (time() - $config['search_last_gc'] <= $config['search_gc']))
+ if (time() - $config['search_gc'] <= $config['search_last_gc'] || !file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx))
{
break;
}
+
include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx");
// We do some additional checks in the module to ensure it can actually be utilised
@@ -79,10 +93,17 @@ switch ($cron_type)
{
$search->tidy();
}
- set_config('search_last_gc', time());
+
+ break;
case 'tidy_warnings':
- include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+
+ if (time() - $config['warnings_gc'] <= $config['warnings_last_gc'])
+ {
+ break;
+ }
+
+ include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
if ($use_shutdown_function)
{
@@ -92,10 +113,17 @@ switch ($cron_type)
{
tidy_warnings();
}
+
break;
case 'tidy_database':
- include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+
+ if (time() - $config['database_gc'] <= $config['database_last_gc'])
+ {
+ break;
+ }
+
+ include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
if ($use_shutdown_function)
{
@@ -105,9 +133,16 @@ switch ($cron_type)
{
tidy_database();
}
+
break;
case 'tidy_sessions':
+
+ if (time() - $config['session_gc'] <= $config['session_last_gc'])
+ {
+ break;
+ }
+
if ($use_shutdown_function)
{
register_shutdown_function(array(&$user, 'session_gc'));
@@ -116,6 +151,7 @@ switch ($cron_type)
{
$user->session_gc();
}
+
break;
case 'prune_forum':
@@ -137,7 +173,7 @@ switch ($cron_type)
// Do the forum Prune thang
if ($row['prune_next'] < time() && $row['enable_prune'])
{
- include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+ include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
if ($row['prune_days'])
{
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 9de5d66b11..280ef4e395 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -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)
*/
/**
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 9defc15717..d5ee879df5 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -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
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 592422f85e..02ca7bbb27 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -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));
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index bc33f96562..a63318e35f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -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)
{
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 2df3c37f9b..5751e39290 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -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);
}
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index f77e65f003..36cb33b816 100755
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -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))
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index b8280d4a9b..0bc6a28f3f 100755
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -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;
}
}
}
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 1fc21ffc8b..af44b98ded 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -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);
}
/**
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 48415ab409..52f56a0450 100755
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -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);
}
/**
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 200c4e3227..306a7e36e1 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -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;
}
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 2213c89e4e..16e2dea4ea 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -69,6 +69,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable', '0'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_hide_groups', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('database_gc', '604800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1');
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 14d0ed952f..a4507e0e10 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -350,6 +350,9 @@ $lang = array_merge($lang, array(
'LOG_ACL_TRANSFER_PERMISSIONS' => 'Permissions transfered from
» %s',
'LOG_ACL_RESTORE_PERMISSIONS' => 'Own permissions restored after using permissions from
» %s',
+ 'LOG_ADMIN_AUTH_FAIL' => 'Failed administration login attempt',
+ 'LOG_ADMIN_AUTH_SUCCESS' => 'Sucessful administration login',
+
'LOG_ATTACH_EXT_ADD' => 'Added or edited attachment extension
» %s',
'LOG_ATTACH_EXT_DEL' => 'Removed attachment extension
» %s',
'LOG_ATTACH_EXT_UPDATE' => 'Updated attachment extension
» %s',
@@ -400,6 +403,20 @@ $lang = array_merge($lang, array(
'LOG_CONFIG_SIGNATURE' => 'Altered signature settings',
'LOG_CONFIG_VISUAL' => 'Altered visual confirmation settings',
+ 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s',
+ 'LOG_DELETE_POST' => 'Deleted post
» %s',
+ 'LOG_DELETE_TOPIC' => 'Deleted topic
» %s',
+ 'LOG_FORK' => 'Copied topic
» from %s',
+ 'LOG_LOCK' => 'Locked topic
» %s',
+ 'LOG_LOCK_POST' => 'Locked post
» %s',
+ 'LOG_MERGE' => 'Merged posts into topic
»%s',
+ 'LOG_MOVE' => 'Moved topic
» from %s',
+ 'LOG_TOPIC_DELETED' => 'Deleted topic
» %s',
+ 'LOG_TOPIC_RESYNC' => 'Resynchronised topic counters
» %s',
+ 'LOG_TOPIC_TYPE_CHANGED' => 'Changed topic type
» %s',
+ 'LOG_UNLOCK' => 'Unlocked topic
» %s',
+ 'LOG_UNLOCK_POST' => 'Unlocked post
» %s',
+
'LOG_DISALLOW_ADD' => 'Added disallowed username
» %s',
'LOG_DISALLOW_DELETE' => 'Deleted disallowed username',
@@ -451,6 +468,8 @@ $lang = array_merge($lang, array(
'LOG_INDEX_REMIND' => 'Sent reminder emails to inactive users
» %s',
'LOG_INSTALL_INSTALLED' => 'Installed phpBB %s',
+ 'LOG_IP_BROWSER_CHECK' => 'Session IP/Browser check failed
»User IP "%s" checked against session IP "%s" and user browser string "%s" checked against session browser string "%s".',
+
'LOG_JAB_CHANGED' => 'Jabber account changed',
'LOG_JAB_PASSCHG' => 'Jabber password changed',
'LOG_JAB_REGISTER' => 'Jabber account registered',
@@ -531,7 +550,6 @@ $lang = array_merge($lang, array(
'LOG_USER_DEL_AVATAR' => 'Removed user avatar
» %s',
'LOG_USER_DEL_POSTS' => 'Removed all posts made by the user
» %s',
'LOG_USER_DEL_SIG' => 'Removed user signature
» %s',
- 'LOG_USER_GROUP_CHANGE' => 'User changed default group
» %s',
'LOG_USER_INACTIVE' => 'User deactivated
» %s',
'LOG_USER_MOVE_POSTS' => 'Moved user posts
» posts by "%s" to forum "%s"',
'LOG_USER_NEW_PASSWORD' => 'Changed user password
» %s',
@@ -540,6 +558,25 @@ $lang = array_merge($lang, array(
'LOG_USER_UPDATE_NAME' => 'Changed username
» from "%s" to "%s"',
'LOG_USER_USER_UPDATE' => 'Updated user details
» %s',
+ 'LOG_USER_ACTIVE_USER' => 'User account activated',
+ 'LOG_USER_DEL_AVATAR_USER' => 'User avatar removed',
+ 'LOG_USER_DEL_SIG_USER' => 'User signature removed',
+ 'LOG_USER_FEEDBACK' => 'Added user feedback
» %s',
+ 'LOG_USER_GENERAL' => '%s',
+ 'LOG_USER_INACTIVE_USER' => 'User account de-activated',
+ 'LOG_USER_LOCK' => 'User locked own topic
» %s',
+ 'LOG_USER_MOVE_POSTS_USER' => 'Moved all posts to forum "%s"',
+ 'LOG_USER_REACTIVATE_USER' => 'Forced user account re-activation',
+ 'LOG_USER_UNLOCK' => 'User unlocked own topic
» %s',
+ 'LOG_USER_WARNING' => 'Added user warning
»%s',
+ 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
»%s',
+
+ 'LOG_USER_GROUP_CHANGE' => 'User changed default group
» %s',
+ 'LOG_USER_GROUP_DEMOTE' => 'User demoted as leaders from usergroup
» %s',
+ 'LOG_USER_GROUP_JOIN' => 'User joined group
» %s',
+ 'LOG_USER_GROUP_JOIN_PENDING' => 'User joined group and needs to be approved
» %s',
+ 'LOG_USER_GROUP_RESIGN' => 'User resigned membership from group
» %s',
+
'LOG_WORD_ADD' => 'Added word censor
» %s',
'LOG_WORD_DELETE' => 'Deleted word censor
» %s',
'LOG_WORD_EDIT' => 'Edited word censor
» %s',
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 483e797666..2e547f745a 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -238,17 +238,7 @@ $lang = array_merge($lang, array(
'LOGIN_VIEWFORUM' => 'The board administrator requires you to be registered and logged in to view this forum.',
'LOGOUT' => 'Logout',
'LOGOUT_USER' => 'Logout [ %s ]',
- 'LOG_ADMIN_AUTH_FAIL' => 'Failed administration login attempt',
- 'LOG_ADMIN_AUTH_SUCCESS'=> 'Sucessful administration login',
- 'LOG_DELETE_POST' => 'Deleted post
» %s',
- 'LOG_DELETE_TOPIC' => 'Deleted topic
» %s',
'LOG_ME_IN' => 'Log me on automatically each visit',
- 'LOG_USER_FEEDBACK' => 'Added user feedback
» %s',
- 'LOG_USER_GENERAL' => '%s',
- 'LOG_USER_WARNING' => 'Added user warning
»%s',
- 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
»%s',
-
- 'LOG_IP_BROWSER_CHECK' => 'Session IP/Browser check failed
»User IP "%s" checked against session IP "%s" and user browser string "%s" checked against session browser string "%s".',
'MARK' => 'Mark',
'MARK_ALL' => 'Mark all',
diff --git a/phpBB/language/en/groups.php b/phpBB/language/en/groups.php
index fb4fac6d54..aad97a25e5 100644
--- a/phpBB/language/en/groups.php
+++ b/phpBB/language/en/groups.php
@@ -66,7 +66,7 @@ $lang = array_merge($lang, array(
'GROUP_LIST' => 'Manage Users',
'LOGIN_EXPLAIN_GROUP' => 'You need to login to view group details',
-
+
'NOT_LEADER_OF_GROUP' => 'The requested operation cannot be taken because you are not a leader of the selected group.',
'NOT_MEMBER_OF_GROUP' => 'The requested operation cannot be taken because you are not a member of the selected group.',
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 13a5d75278..fe05644539 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -111,26 +111,6 @@ $lang = array_merge($lang, array(
'LOCK_TOPICS' => 'Lock selected topics',
'LOCK_TOPICS_CONFIRM' => 'Are you sure you want to lock all selected topics?',
'LOGS_CURRENT_TOPIC' => 'Currently viewing logs of:',
- 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s',
- 'LOG_FORK' => 'Copied topic
» from %s',
- 'LOG_LOCK' => 'Locked topic
» %s',
- 'LOG_LOCK_POST' => 'Locked post
» %s',
- 'LOG_MERGE' => 'Merged posts into topic
»%s',
- 'LOG_MOVE' => 'Moved topic
» from %s',
- 'LOG_TOPIC_DELETED' => 'Deleted topic
» %s',
- 'LOG_TOPIC_RESYNC' => 'Resynchronised topic counters
» %s',
- 'LOG_TOPIC_TYPE_CHANGED' => 'Changed topic type
» %s',
- 'LOG_UNLOCK' => 'Unlocked topic
» %s',
- 'LOG_UNLOCK_POST' => 'Unlocked post
» %s',
- 'LOG_UNRATE' => 'Unrated post
» %s',
- 'LOG_USER_ACTIVE_USER' => 'User account activated',
- 'LOG_USER_DEL_AVATAR_USER' => 'User avatar removed',
- 'LOG_USER_DEL_SIG_USER' => 'User signature removed',
- 'LOG_USER_INACTIVE_USER' => 'User account de-activated',
- 'LOG_USER_LOCK' => 'User locked own topic
» %s',
- 'LOG_USER_MOVE_POSTS_USER' => 'Moved all posts to forum "%s"',
- 'LOG_USER_REACTIVATE_USER' => 'Forced user account re-activation',
- 'LOG_USER_UNLOCK' => 'User unlocked own topic
» %s',
'LOGIN_EXPLAIN_MCP' => 'To moderate this forum you must login.',
'LOGVIEW_VIEWTOPIC' => 'View Topic',
'LOGVIEW_VIEWLOGS' => 'View Topic Log',