diff options
Diffstat (limited to 'phpBB/includes/cron/manager.php')
-rw-r--r-- | phpBB/includes/cron/manager.php | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/phpBB/includes/cron/manager.php b/phpBB/includes/cron/manager.php index ae48e233e0..a0bf018b33 100644 --- a/phpBB/includes/cron/manager.php +++ b/phpBB/includes/cron/manager.php @@ -33,64 +33,24 @@ class phpbb_cron_manager protected $tasks = array(); /** - * An extension manager to search for cron tasks in extensions. - * @var phpbb_extension_manager - */ - protected $extension_manager; - - /** * Constructor. Loads all available tasks. * - * Tasks will be looked up in the core task directory located in - * includes/cron/task/core/ and in extensions. Task classes will be - * autoloaded and must be named according to autoloading naming conventions. - * - * Tasks in extensions must be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. - * - * @param phpbb_extension_manager $extension_manager phpBB extension manager + * @param array|Traversable $task_names Provides an iterable set of task names */ - public function __construct(phpbb_extension_manager $extension_manager) + public function __construct($task_names) { - $this->extension_manager = $extension_manager; - - $task_names = $this->find_cron_task_names(); $this->load_tasks($task_names); } /** - * Finds cron task names using the extension manager. - * - * All PHP files in includes/cron/task/core/ are considered tasks. Tasks - * in extensions have to be located in a directory called cron or a subdir - * of a directory called cron. The class and filename must end in a _task - * suffix. - * - * @return array List of task names - */ - public function find_cron_task_names() - { - $finder = $this->extension_manager->get_finder(); - - return $finder - ->suffix('_task') - ->directory('/cron') - ->default_path('includes/cron/task/core/') - ->default_suffix('') - ->default_directory('') - ->get_classes(); - } - - /** * Loads tasks given by name, wraps them * and puts them into $this->tasks. * - * @param array $task_names Array of strings + * @param array|Traversable $task_names Array of strings * * @return void */ - public function load_tasks(array $task_names) + public function load_tasks($task_names) { foreach ($task_names as $task_name) { |