From 9761c1bf617763671308fabc569ec13d40cb6843 Mon Sep 17 00:00:00 2001 From: LEZY Thomas Date: Wed, 28 May 2014 12:57:49 +0200 Subject: [PATCH] [ticket/12597] Fix various refactoring mistakes PHPBB3-12597 --- phpBB/cron.php | 20 +++---------------- .../console/command/cron/execute_all.php | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/phpBB/cron.php b/phpBB/cron.php index c708527d99..b35d16632a 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -33,20 +33,6 @@ function output_image() flush(); } -function do_cron($cron_lock, $run_tasks) -{ - global $config; - - foreach ($run_tasks as $task) - { - $task->run(); - } - - // Unloading cache and closing db after having done the dirty work. - $cron_lock->release(); - garbage_collection(); -} - // Thanks to various fatal errors and lack of try/finally, it is quite easy to leave // the cron lock locked, especially when working on cron-related code. // @@ -65,7 +51,6 @@ if ($cron_lock->acquire()) $cron = $phpbb_container->get('cron.manager'); // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing - $run_tasks = array(); $task = $cron->find_task($cron_type); if ($task) { @@ -75,11 +60,12 @@ if ($cron_lock->acquire()) } if ($task->is_ready()) { - $run_tasks = array($task); + $task->run(); + $cron_lock->release(); + garbage_collection(); } } - do_cron($cron_lock, $run_tasks); } else { diff --git a/phpBB/phpbb/console/command/cron/execute_all.php b/phpBB/phpbb/console/command/cron/execute_all.php index bc46fbe81b..f7157f4d3a 100644 --- a/phpBB/phpbb/console/command/cron/execute_all.php +++ b/phpBB/phpbb/console/command/cron/execute_all.php @@ -72,7 +72,7 @@ class execute_all extends \phpbb\console\command\command { if ($input->getOption('verbose')) { - $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name()) . "\n"); + $output->writeln($this->user->lang('RUNNING_TASK', $task->get_name())); } $task->run();