aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/cron.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-05-18 18:18:32 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-05-18 18:18:32 +0000
commit7e25c8d9cc255fbe460c2a970ad7da241c0880bb (patch)
tree89bb537574b06359d58f515a07fa6e37b6c63cf9 /phpBB/cron.php
parentf15d6862ae4a62421da83e10dfdeb7153756af1a (diff)
downloadforums-7e25c8d9cc255fbe460c2a970ad7da241c0880bb.tar
forums-7e25c8d9cc255fbe460c2a970ad7da241c0880bb.tar.gz
forums-7e25c8d9cc255fbe460c2a970ad7da241c0880bb.tar.bz2
forums-7e25c8d9cc255fbe460c2a970ad7da241c0880bb.tar.xz
forums-7e25c8d9cc255fbe460c2a970ad7da241c0880bb.zip
- 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
Diffstat (limited to 'phpBB/cron.php')
-rw-r--r--phpBB/cron.php58
1 files changed, 47 insertions, 11 deletions
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'])
{