1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/dic] Give all cron tasks a name, change some manager usage

PHPBB3-10739
This commit is contained in:
Igor Wiedler
2012-04-09 14:34:35 +02:00
parent aa0c995ed9
commit 3896ee953f
8 changed files with 61 additions and 23 deletions

View File

@@ -32,13 +32,18 @@ class phpbb_cron_manager
*/
protected $tasks = array();
protected $phpbb_root_path, $phpEx;
/**
* Constructor. Loads all available tasks.
*
* @param array|Traversable $tasks Provides an iterable set of task names
*/
public function __construct($tasks)
public function __construct($tasks, $phpbb_root_path, $phpEx)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->load_tasks($tasks);
}
@@ -54,8 +59,7 @@ class phpbb_cron_manager
{
foreach ($tasks as $task)
{
$wrapper = new phpbb_cron_task_wrapper($task);
$this->tasks[] = $wrapper;
$this->tasks[] = $this->wrap_task($task);
}
}
@@ -119,4 +123,9 @@ class phpbb_cron_manager
}
return null;
}
public function wrap_task(phpbb_cron_task $task)
{
return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->phpEx);
}
}