'Spam Purge', 'url' => 'http://habariproject.org/', 'author' => 'Owen Winkler', 'authorurl' => 'http://asymptomatic.net/', 'version' => '1.0', 'description' => 'Deletes spam comments older than a certain number of days', 'license' => 'Apache License 2.0', ); } function action_plugin_activation( $plugin_file ) { if( Plugins::id_from_file(__FILE__) == Plugins::id_from_file($plugin_file) ) { CronTab::add_daily_cron('spampurge', 'purge_spam', 'Deletes spam comments after a certain number of days.'); Options::set('spampurge__days', 3); } } function filter_purge_spam() { $days = Options::get('spampurge__days'); // This part doesn't work: $sql = "DELETE FROM {comments} c, {commentinfo} ci WHERE c.id = ci.comment_id AND c.date < ? AND c.status = ?"; $oldest = time() - 86400 * $days; DB::query($sql, array($oldest, Comment::STATUS_SPAM)); } } ?>