diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-02 00:34:34 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-02 00:34:34 -0800 |
commit | d2cb217e20d44d7928a0910ac0375740de163bb3 (patch) | |
tree | 8b7a45adb4457cbd7ed291b8151cf330a13fbf10 /modules/gallery/controllers/admin_maintenance.php | |
parent | c803cb29091d3b069077d7711a2485f75f274835 (diff) |
Convert more database calls over to the new format
- admin/maintenance page loads, the rebuild thumbs/resizes task works
- Fixed up some conversion bugs in the Cache driver
Diffstat (limited to 'modules/gallery/controllers/admin_maintenance.php')
-rw-r--r-- | modules/gallery/controllers/admin_maintenance.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php index 6377f40f..213e4fe2 100644 --- a/modules/gallery/controllers/admin_maintenance.php +++ b/modules/gallery/controllers/admin_maintenance.php @@ -22,11 +22,13 @@ class Admin_Maintenance_Controller extends Admin_Controller { * Show a list of all available, running and finished tasks. */ public function index() { - $query = Database::instance()->query( - "UPDATE {tasks} SET `state` = 'stalled' " . - "WHERE done = 0 " . - "AND state <> 'stalled' " . - "AND unix_timestamp(now()) - updated > 15"); + $query = db::build() + ->update("tasks") + ->set("state", "stalled") + ->where("done", "=", 0) + ->where("state", "<>", "stalled") + ->where(new Database_Expression("UNIX_TIMESTAMP(NOW()) - `updated` > 15")) + ->execute(); $stalled_count = $query->count(); if ($stalled_count) { log::warning("tasks", @@ -138,10 +140,12 @@ class Admin_Maintenance_Controller extends Admin_Controller { public function cancel_running_tasks() { access::verify_csrf(); - Database::instance()->update( - "tasks", - array("done" => 1, "state" => "cancelled"), - array("done" => 0)); + db::build() + ->update("tasks") + ->set("done", 1) + ->set("state", "cancelled") + ->where("done", "=", 0) + ->execute(); message::success(t("All running tasks cancelled")); url::redirect("admin/maintenance"); } |