diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-01 16:31:24 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-01 16:31:24 -0800 |
commit | 5ded9e8ac5935e41c08d1766974ce31890efd7f0 (patch) | |
tree | 3caaee0e2938ea3f39f1aad39551652e9a2ec8e1 /modules/gallery/helpers/task.php | |
parent | 48cb5021c6bd7e65a13a0ff50a9e76f72da7d3a1 (diff) |
Refactor starting a task into the task helper so we can call it multiple times.
Diffstat (limited to 'modules/gallery/helpers/task.php')
-rw-r--r-- | modules/gallery/helpers/task.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php index 645850d1..aa0eb94d 100644 --- a/modules/gallery/helpers/task.php +++ b/modules/gallery/helpers/task.php @@ -35,6 +35,15 @@ class task_Core { return $tasks; } + static function start($task_callback, $context=array()) { + $tasks = task::get_definitions(); + $task = task::create($tasks[$task_callback], array()); + + $task->log(t("Task %task_name started (task id %task_id)", + array("task_name" => $task->name, "task_id" => $task->id))); + return $task; + } + static function create($task_def, $context) { $task = ORM::factory("task"); $task->callback = $task_def->callback; |