diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2010-04-14 16:14:32 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-02-12 22:05:48 -0500 |
commit | 77d7238eef84f498fc024fa8b9e06f187dd0f2a6 (patch) | |
tree | b12c005233f4a25b704b27956f9ff047840b56b4 /phpBB/includes/functions.php | |
parent | 8f0e9aee5ce518937b7ed05c2cd602e85e5b0b8a (diff) | |
download | forums-77d7238eef84f498fc024fa8b9e06f187dd0f2a6.tar forums-77d7238eef84f498fc024fa8b9e06f187dd0f2a6.tar.gz forums-77d7238eef84f498fc024fa8b9e06f187dd0f2a6.tar.bz2 forums-77d7238eef84f498fc024fa8b9e06f187dd0f2a6.tar.xz forums-77d7238eef84f498fc024fa8b9e06f187dd0f2a6.zip |
[feature/system-cron] WIP on making cron tasks runnable via system cron
PHPBB3-9596
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 056d578e75..eb787bfc62 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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)); } } |