aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/cron/manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/cron/manager.php')
-rw-r--r--phpBB/phpbb/cron/manager.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php
index b6af07aff7..079ce8107e 100644
--- a/phpBB/phpbb/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package phpBB3
-* @copyright (c) 2010 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -13,8 +17,6 @@ namespace phpbb\cron;
* Cron manager class.
*
* Finds installed cron tasks, stores task objects, provides task selection.
-*
-* @package phpBB3
*/
class manager
{
@@ -32,7 +34,9 @@ class manager
/**
* Constructor. Loads all available tasks.
*
- * @param array|Traversable $tasks Provides an iterable set of task names
+ * @param array|\Traversable $tasks Provides an iterable set of task names
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $php_ext PHP file extension
*/
public function __construct($tasks, $phpbb_root_path, $php_ext)
{
@@ -46,7 +50,7 @@ class manager
* Loads tasks given by name, wraps them
* and puts them into $this->tasks.
*
- * @param array|Traversable $tasks Array of instances of \phpbb\cron\task\task
+ * @param array|\Traversable $tasks Array of instances of \phpbb\cron\task\task
*
* @return null
*/
@@ -69,6 +73,7 @@ class manager
*/
public function find_one_ready_task()
{
+ shuffle($this->tasks);
foreach ($this->tasks as $task)
{
if ($task->is_ready())
@@ -120,6 +125,16 @@ class manager
}
/**
+ * Find all tasks and return them.
+ *
+ * @return array List of all tasks.
+ */
+ public function get_tasks()
+ {
+ return $this->tasks;
+ }
+
+ /**
* Wraps a task inside an instance of \phpbb\cron\task\wrapper.
*
* @param \phpbb\cron\task\task $task The task.