From 622da5f3cdf7ccb979334e42e115f0538c8dd00b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 16 Jan 2009 05:01:22 +0000 Subject: Rename Task to Task_Definition to avoid confusion with Task_Model. Order the finished tasks by update time in the task list. --- core/controllers/admin_maintenance.php | 6 ++-- core/helpers/core_task.php | 2 +- core/libraries/Task.php | 51 ---------------------------------- core/libraries/Task_Definition.php | 51 ++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 54 deletions(-) delete mode 100644 core/libraries/Task.php create mode 100644 core/libraries/Task_Definition.php (limited to 'core') diff --git a/core/controllers/admin_maintenance.php b/core/controllers/admin_maintenance.php index 077bf098..cd1682cc 100644 --- a/core/controllers/admin_maintenance.php +++ b/core/controllers/admin_maintenance.php @@ -59,8 +59,10 @@ class Admin_Maintenance_Controller extends Admin_Controller { $view = new Admin_View("admin.html"); $view->content = new View("admin_maintenance.html"); $view->content->task_definitions = $this->_get_task_definitions(); - $view->content->running_tasks = ORM::factory("task")->where("done", 0)->find_all(); - $view->content->finished_tasks = ORM::factory("task")->where("done", 1)->find_all(); + $view->content->running_tasks = + ORM::factory("task")->where("done", 0)->orderby("updated", "desc")->find_all(); + $view->content->finished_tasks = + ORM::factory("task")->where("done", 1)->orderby("updated", "desc")->find_all(); $view->content->csrf = access::csrf_token(); print $view; } diff --git a/core/helpers/core_task.php b/core/helpers/core_task.php index 6e90035a..8ec3363e 100644 --- a/core/helpers/core_task.php +++ b/core/helpers/core_task.php @@ -20,7 +20,7 @@ class core_task_Core { static function available_tasks() { $dirty_count = graphics::find_dirty_images_query()->count(); - return array(Task::factory() + return array(Task_Definition::factory() ->callback("core_task::rebuild_dirty_images") ->name(t("Rebuild Images")) ->description($dirty_count ? diff --git a/core/libraries/Task.php b/core/libraries/Task.php deleted file mode 100644 index 8145c512..00000000 --- a/core/libraries/Task.php +++ /dev/null @@ -1,51 +0,0 @@ -callback = $callback; - return $this; - } - - function description($description) { - $this->description = $description; - return $this; - } - - function name($name) { - $this->name = $name; - return $this; - } - - function severity($severity) { - $this->severity = $severity; - return $this; - } - -} diff --git a/core/libraries/Task_Definition.php b/core/libraries/Task_Definition.php new file mode 100644 index 00000000..454b39ad --- /dev/null +++ b/core/libraries/Task_Definition.php @@ -0,0 +1,51 @@ +callback = $callback; + return $this; + } + + function description($description) { + $this->description = $description; + return $this; + } + + function name($name) { + $this->name = $name; + return $this; + } + + function severity($severity) { + $this->severity = $severity; + return $this; + } + +} -- cgit v1.2.3