From 44bfc1c6a42838732669e59f686069491b583fe2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 10 Jan 2009 11:25:33 +0000 Subject: Auto-delete 7-day old spam/deleted comments. --- modules/comment/controllers/admin_comments.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/comment/controllers') diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index c5fab259..5460d651 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -55,7 +55,13 @@ class Admin_Comments_Controller extends Admin_Controller { } public function index() { - $this->queue("unpublished"); + // Get rid of old deleted/spam comments + Database::instance()->query( + "DELETE FROM `comments` " . + "WHERE state IN ('deleted', 'spam') " . + "AND unix_timestamp(now()) - updated > 86400 * 7"); + + $this->queue("unpublished"); } public function menu_labels($state) { -- cgit v1.2.3