aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLEZY Thomas <thomas.gif.91@gmail.com>2014-05-27 12:36:44 +0200
committerLEZY Thomas <thomas.gif.91@gmail.com>2014-05-27 18:37:37 +0200
commitabb8a2892d862c097285ee7f300d12c32428e12c (patch)
tree78cdcdbd88ef88aaacef3ccaccb792bd2bdccaab /phpBB/cron.php
parentMerge pull request #2458 from prototech/ticket/12543 (diff)
downloadphpbb-abb8a2892d862c097285ee7f300d12c32428e12c.tar.gz
phpbb-abb8a2892d862c097285ee7f300d12c32428e12c.tar.bz2
phpbb-abb8a2892d862c097285ee7f300d12c32428e12c.zip
[ticket/12597] Command for executing all available cron tasks
Command cron:execute-all executes all available cron tasks. Test files in tests/console/cron folder PHPBB3-12597
Diffstat (limited to 'phpBB/cron.php')
-rw-r--r--phpBB/cron.php43
1 files changed, 14 insertions, 29 deletions
diff --git a/phpBB/cron.php b/phpBB/cron.php
index f63642faa2..a8333aecaf 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -39,11 +39,6 @@ function do_cron($cron_lock, $run_tasks)
foreach ($run_tasks as $task)
{
- if (defined('DEBUG') && $config['use_system_cron'])
- {
- echo "[phpBB cron] Running task '{$task->get_name()}'\n";
- }
-
$task->run();
}
@@ -59,38 +54,28 @@ 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_type = request_var('cron_type', '');
+$cron_type = request_var('cron_type', '');
- // Comment this line out for debugging so the page does not return an image.
- output_image();
-}
+// Comment this line out for debugging so the page does not return an image.
+output_image();
$cron_lock = $phpbb_container->get('cron.lock_db');
if ($cron_lock->acquire())
{
$cron = $phpbb_container->get('cron.manager');
- if ($config['use_system_cron'])
+ // 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)
{
- $run_tasks = $cron->find_all_ready_tasks();
- }
- else
- {
- // 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)
+ if ($task->is_parametrized())
+ {
+ $task->parse_parameters($request);
+ }
+ if ($task->is_ready())
{
- if ($task->is_parametrized())
- {
- $task->parse_parameters($request);
- }
- if ($task->is_ready())
- {
- $run_tasks = array($task);
- }
+ $run_tasks = array($task);
}
}
@@ -100,6 +85,6 @@ else
{
if (defined('DEBUG'))
{
- echo "Could not obtain cron lock.\n";
+ echo $this->user->lang('CRON_LOCK_ERROR') . '\n';
}
}