diff options
| author | Igor Wiedler <igor@wiedler.ch> | 2012-04-09 00:22:55 +0200 |
|---|---|---|
| committer | Igor Wiedler <igor@wiedler.ch> | 2012-04-09 12:42:31 +0200 |
| commit | 2e76620c8824da62f97cfdaee8f9b1014159fd7c (patch) | |
| tree | f5868b1b7209a545bda547138f563b82179ea56f /phpBB/includes/cron/manager.php | |
| parent | 9165a045c5dee06bb5c163281bb817369a1733a3 (diff) | |
| download | forums-2e76620c8824da62f97cfdaee8f9b1014159fd7c.tar forums-2e76620c8824da62f97cfdaee8f9b1014159fd7c.tar.gz forums-2e76620c8824da62f97cfdaee8f9b1014159fd7c.tar.bz2 forums-2e76620c8824da62f97cfdaee8f9b1014159fd7c.tar.xz forums-2e76620c8824da62f97cfdaee8f9b1014159fd7c.zip | |
[feature/dic] Rewrite cron system to use DIC
PHPBB3-10739
Diffstat (limited to 'phpBB/includes/cron/manager.php')
| -rw-r--r-- | phpBB/includes/cron/manager.php | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index 7a78a1b054..5abbc987dd 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -35,26 +35,25 @@ class phpbb_cron_manager /** * Constructor. Loads all available tasks. * - * @param array|Traversable $task_names Provides an iterable set of task names + * @param array|Traversable $tasks Provides an iterable set of task names */ - public function __construct($task_names) + public function __construct($tasks) { - $this->load_tasks($task_names); + $this->load_tasks($tasks); } /** * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array|Traversable $task_names Array of strings + * @param array|Traversable $tasks Array of instances of phpbb_cron_task * * @return void */ - public function load_tasks($task_names) + public function load_tasks($tasks) { - foreach ($task_names as $task_name) + foreach ($tasks as $task) { - $task = new $task_name(); $wrapper = new phpbb_cron_task_wrapper($task); $this->tasks[] = $wrapper; } @@ -120,27 +119,4 @@ class phpbb_cron_manager } return null; } - - /** - * Creates an instance of parametrized cron task $name with args $args. - * The constructed task is wrapped with cron task wrapper before being returned. - * - * @param string $name The task name, which is the same as cron task class name. - * @param array $args Will be passed to the task class's constructor. - * - * @return phpbb_cron_task_wrapper|null - */ - public function instantiate_task($name, array $args) - { - $task = $this->find_task($name); - if ($task) - { - // task here is actually an instance of cron task wrapper - $class = $task->get_name(); - $task = new $class($args); - // need to wrap the new task too - $task = new phpbb_cron_task_wrapper($task); - } - return $task; - } } |
