From ccf5902c50ecd8fc5307efbb64a20aa19a2652b4 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 9 May 2010 16:47:52 -0400 Subject: [PATCH] [feature/system-cron] Fixed instantiate_task to work correctly. PHPBB3-9596 --- phpBB/includes/cron/cron_manager.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/cron/cron_manager.php b/phpBB/includes/cron/cron_manager.php index 5c3bfd01b5..a97f2bde4e 100644 --- a/phpBB/includes/cron/cron_manager.php +++ b/phpBB/includes/cron/cron_manager.php @@ -168,13 +168,23 @@ class cron_manager return null; } + /** + * Creates an instance of parametrized cron task $name with args $args. + * + * $name is the task name, which is the same as cron task class name. + * $args will be passed to the task class's constructor. + * The constructed task is wrapped with cron task wrapper before being returned. + */ function instantiate_task($name, $args) { $task = $this->find_task($name); if ($task) { - $class = get_class($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 cron_task_wrapper($task); } return $task; }