Skip to content

Commit

Permalink
Modify the expiration code to work with db::build()
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Nov 26, 2009
1 parent 1fd0e14 commit dd2bca0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/comment/controllers/admin_comments.php
Expand Up @@ -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");
Expand Down

0 comments on commit dd2bca0

Please sign in to comment.