From dd2bca022479f5971ca3afd3d8284474c6c5e87a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 26 Nov 2009 12:54:07 -0800 Subject: Modify the expiration code to work with db::build() --- modules/comment/controllers/admin_comments.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'modules/comment/controllers') diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index 271c7d51..c67fc4a4 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -22,10 +22,11 @@ class Admin_Comments_Controller extends Admin_Controller { public function index() { // Get rid of old deleted/spam comments once in a while - Database::instance()->query( - "DELETE FROM {comments} " . - "WHERE state IN ('deleted', 'spam') " . - "AND unix_timestamp(now()) - updated > 86400 * 7"); + db::build() + ->delete("comments") + ->where("state", "IN", array("deleted", "spam")) + ->where("updated", "<", "UNIX_TIMESTAMP() - 86400 * 7") + ->execute(); // Redirect to the appropriate queue url::redirect("admin/comments/queue/unpublished"); -- cgit v1.2.3