[ticket/12597] Fix various refactoring mistakes

PHPBB3-12597
This commit is contained in:
LEZY Thomas 2014-05-28 12:57:49 +02:00
parent 6f0121e2a4
commit 9761c1bf61
2 changed files with 4 additions and 18 deletions

View file

@ -33,20 +33,6 @@ function output_image()
flush(); 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 // 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. // 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'); $cron = $phpbb_container->get('cron.manager');
// If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing // 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); $task = $cron->find_task($cron_type);
if ($task) if ($task)
{ {
@ -75,11 +60,12 @@ if ($cron_lock->acquire())
} }
if ($task->is_ready()) if ($task->is_ready())
{ {
$run_tasks = array($task); $task->run();
$cron_lock->release();
garbage_collection();
} }
} }
do_cron($cron_lock, $run_tasks);
} }
else else
{ {

View file

@ -72,7 +72,7 @@ class execute_all extends \phpbb\console\command\command
{ {
if ($input->getOption('verbose')) 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(); $task->run();