1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 03:34:04 +02:00

[ticket/14542] Move cron to controller

PHPBB3-14542
This commit is contained in:
Máté Bartus
2016-03-18 22:57:02 +01:00
parent d74e85ffd9
commit 6eecc26e31
13 changed files with 374 additions and 83 deletions

View File

@@ -13,6 +13,9 @@
namespace phpbb\cron;
use phpbb\cron\task\wrapper;
use phpbb\routing\helper;
/**
* Cron manager class.
*
@@ -20,6 +23,11 @@ namespace phpbb\cron;
*/
class manager
{
/**
* @var helper
*/
protected $routing_helper;
/**
* Set of \phpbb\cron\task\wrapper objects.
* Array holding all tasks that have been found.
@@ -28,18 +36,27 @@ class manager
*/
protected $tasks = array();
/**
* @var string
*/
protected $phpbb_root_path;
/**
* @var string
*/
protected $php_ext;
/**
* Constructor. Loads all available tasks.
*
* @param array|\Traversable $tasks Provides an iterable set of task names
* @param helper $routing_helper Routing helper
* @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)
public function __construct($tasks, helper $routing_helper, $phpbb_root_path, $php_ext)
{
$this->routing_helper = $routing_helper;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@@ -142,6 +159,6 @@ class manager
*/
public function wrap_task(\phpbb\cron\task\task $task)
{
return new \phpbb\cron\task\wrapper($task, $this->phpbb_root_path, $this->php_ext);
return new wrapper($task, $this->routing_helper, $this->phpbb_root_path, $this->php_ext);
}
}