summaryrefslogtreecommitdiff
path: root/core/controllers/admin_maintenance.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-03-09 07:28:19 +0000
committerBharat Mediratta <bharat@menalto.com>2009-03-09 07:28:19 +0000
commite37faa0008df38088a55932786955e68ee1f955f (patch)
tree78fc0df349fb5a55335c81f2608c202eee9fcd5a /core/controllers/admin_maintenance.php
parent622358ebc8eba1cfd17f8e7cbb5c8557fd7c4bee (diff)
More tasks cleanup.
Don't join through to the users table; that won't work in embedded mode. Instead, add Tasks_Model::owner() that calls user::lookup() and refer to the object directly in the view. Add Admin_Maintenance:remove_finished_tasks() so that we can easily do old task cleanup. Hide Running / Finished sections if there aren't any running or finished tasks.
Diffstat (limited to 'core/controllers/admin_maintenance.php')
-rw-r--r--core/controllers/admin_maintenance.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/controllers/admin_maintenance.php b/core/controllers/admin_maintenance.php
index c98251bc..80403906 100644
--- a/core/controllers/admin_maintenance.php
+++ b/core/controllers/admin_maintenance.php
@@ -42,12 +42,8 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->content = new View("admin_maintenance.html");
$view->content->task_definitions = task::get_definitions("admin");
$view->content->running_tasks = ORM::factory("task")
- ->select("tasks.*", "users.name as user_name")
- ->join("users", "tasks.owner_id", "users.id")
->where("done", 0)->orderby("updated", "DESC")->find_all();
$view->content->finished_tasks = ORM::factory("task")
- ->select("tasks.*", "users.name as user_name")
- ->join("users", "tasks.owner_id", "users.id")
->where("done", 1)->orderby("updated", "DESC")->find_all();
$view->content->csrf = access::csrf_token();
print $view;
@@ -119,6 +115,13 @@ class Admin_Maintenance_Controller extends Admin_Controller {
url::redirect("admin/maintenance");
}
+ public function remove_finished_tasks() {
+ access::verify_csrf();
+ Database::instance()->delete("tasks", array("done" => 1));
+ message::success(t("All finished tasks removed"));
+ url::redirect("admin/maintenance");
+ }
+
/**
* Run a task. This will trigger the task to do a small amount of work, then it will report
* back with status on the task.