summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-11 03:14:52 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-11 03:14:52 +0000
commit8da729cfa1ed17040720ddeefbfd6f4ec541bc9c (patch)
treeb25ade47dc6e929e2a7020ca98870825a7f5da16 /core
parent47756db8569400d5d23dbb1c30dd40f00c7beaf1 (diff)
Refine the task api but removing the optional parameters on the
task::create method call
Diffstat (limited to 'core')
-rw-r--r--core/controllers/admin_maintenance.php4
-rw-r--r--core/helpers/task.php14
2 files changed, 6 insertions, 12 deletions
diff --git a/core/controllers/admin_maintenance.php b/core/controllers/admin_maintenance.php
index 6da04e46..99d6f067 100644
--- a/core/controllers/admin_maintenance.php
+++ b/core/controllers/admin_maintenance.php
@@ -56,7 +56,9 @@ class Admin_Maintenance_Controller extends Admin_Controller {
public function start($task_callback) {
access::verify_csrf();
- $task = task::create($task_callback);
+ $tasks = task::get_definitions();
+
+ $task = task::create($tasks[$task_callback], array());
$view = new View("admin_maintenance_task.html");
$view->csrf = access::csrf_token();
diff --git a/core/helpers/task.php b/core/helpers/task.php
index 75151796..051cc76d 100644
--- a/core/helpers/task.php
+++ b/core/helpers/task.php
@@ -35,18 +35,10 @@ class task_Core {
return $tasks;
}
- static function create($task_callback, $task_name=null, $context=array()) {
+ static function create($task_definitions, $context) {
$task = ORM::factory("task");
- $task->callback = $task_callback;
- if (empty($task_name)) {
- $task_definitions = self::get_definitions();
- $task->name = $task_definitions[$task_callback]->name;
- } else {
- $task->name = $task_name;
- }
- if (empty($task->name)) {
- $task_name = $task_callback;
- }
+ $task->callback = $task_definitions->callback;
+ $task->name = $task_definitions->name;
$task->percent_complete = 0;
$task->status = "";
$task->state = "started";