summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/admin_maintenance.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-07-06 22:20:04 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-07-06 22:20:04 -0700
commit493fb27825327e14168c3c0b133c338a53457e0e (patch)
tree2df161468e14334211cbfd2984c674af46dd320f /modules/gallery/controllers/admin_maintenance.php
parent6588f3bbd16c0ca91809a11a2e9b341d6a7c85a6 (diff)
Cleanup remove task processing. Change Task_Model::delete to call parent::delete
instead of parent::save. :-) Also change admin_maintenance_controller to delete via looping over all of the completed tasks and delete individually, so we can delete the associated cache entries at the same time.
Diffstat (limited to 'modules/gallery/controllers/admin_maintenance.php')
-rw-r--r--modules/gallery/controllers/admin_maintenance.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php
index a65bd770..37cc5222 100644
--- a/modules/gallery/controllers/admin_maintenance.php
+++ b/modules/gallery/controllers/admin_maintenance.php
@@ -161,7 +161,14 @@ class Admin_Maintenance_Controller extends Admin_Controller {
public function remove_finished_tasks() {
access::verify_csrf();
- Database::instance()->delete("tasks", array("done" => 1));
+
+ // Do it the long way so we can call delete and remove the cache.
+ $finished = ORM::factory("task")
+ ->where(array("done" => 1))
+ ->find_all();
+ foreach ($finished as $task) {
+ task::remove($task->id);
+ }
message::success(t("All finished tasks removed"));
url::redirect("admin/maintenance");
}