1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

[feature/system-cron] WIP on making cron tasks runnable via system cron

PHPBB3-9596
This commit is contained in:
Oleg Pudeyev
2010-04-14 16:14:32 -04:00
parent 8f0e9aee5c
commit 77d7238eef
7 changed files with 421 additions and 287 deletions

View File

@@ -4595,7 +4595,7 @@ function page_footer($run_cron = true)
// Call cron-type script
$call_cron = false;
if (!defined('IN_CRON') && $run_cron && !$config['board_disable'])
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'])
{
$call_cron = true;
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
@@ -4616,40 +4616,12 @@ function page_footer($run_cron = true)
// Call cron job?
if ($call_cron)
{
$cron_type = '';
if ($time_now - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx))
{
// Process email queue
$cron_type = 'queue';
}
else if (method_exists($cache, 'tidy') && $time_now - $config['cache_gc'] > $config['cache_last_gc'])
{
// Tidy the cache
$cron_type = 'tidy_cache';
}
else if ($config['warnings_expire_days'] && ($time_now - $config['warnings_gc'] > $config['warnings_last_gc']))
{
$cron_type = 'tidy_warnings';
}
else if ($time_now - $config['database_gc'] > $config['database_last_gc'])
{
// Tidy the database
$cron_type = 'tidy_database';
}
else if ($time_now - $config['search_gc'] > $config['search_last_gc'])
{
// Tidy the search
$cron_type = 'tidy_search';
}
else if ($time_now - $config['session_gc'] > $config['session_last_gc'])
{
$cron_type = 'tidy_sessions';
}
global $cron;
$cron_type = $cron->find_one_runnable_task();
if ($cron_type)
{
$template->assign_var('RUN_CRON_TASK', '<img src="' . append_sid($phpbb_root_path . 'cron.' . $phpEx, 'cron_type=' . $cron_type) . '" width="1" height="1" alt="cron" />');
$template->assign_var('RUN_CRON_TASK', $cron->generate_task_code($cron_type));
}
}