From ff280d3f466dcb139af98b027317291e4ca45b2f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 22 May 2014 12:11:02 +0200 Subject: [PATCH 1/2] [ticket/12576] Remove cron from common.php PHPBB3-12576 --- phpBB/common.php | 5 ----- phpBB/includes/functions.php | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index 4ad669a021..d8375d365b 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -108,11 +108,6 @@ foreach ($phpbb_hook_finder->find() as $hook) @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); } -if (!$config['use_system_cron']) -{ - $cron = $phpbb_container->get('cron.manager'); -} - /** * Main event which is triggered on every page * diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 49568bb1b2..adb6e1a0a0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5116,7 +5116,8 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = // Call cron job? if ($call_cron) { - global $cron; + global $phpbb_container; + $cron = $phpbb_container->get('cron.manager'); $task = $cron->find_one_ready_task(); if ($task) From 004b3178761fb4e5f954049194751d1fb7f512c0 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 22 May 2014 13:47:37 +0200 Subject: [PATCH 2/2] [ticket/12576] Retrieve the cron_manager in cron.php if needed PHPBB3-12576 --- phpBB/cron.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index 787183f689..f63642faa2 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -59,11 +59,7 @@ function do_cron($cron_lock, $run_tasks) // // If DEBUG is defined and cron lock cannot be obtained, a message will be printed. -if ($config['use_system_cron']) -{ - $cron = $phpbb_container->get('cron.manager'); -} -else +if (!$config['use_system_cron']) { $cron_type = request_var('cron_type', ''); @@ -74,6 +70,8 @@ else $cron_lock = $phpbb_container->get('cron.lock_db'); if ($cron_lock->acquire()) { + $cron = $phpbb_container->get('cron.manager'); + if ($config['use_system_cron']) { $run_tasks = $cron->find_all_ready_tasks();