On 7/6/08, paulbutcher <p
...@paulbutcher.com> wrote:
> I've had a blog running on top of Mephisto 0.7.3 for a while now - and
> I've been ignoring it. My bad, I know, but I've had other things on my
> mind :-)
> While I've been ignoring it, the spammers have found it and I have
> several thousand spam comments :-(
> Bastards.
> Is there some way that I can run akismet retrospectively to kill the
> spam comments? Or delete all comments younger than a certain date (I'm
> pretty sure that all the "real" comments are old and all the new
> comments are, therefore, spam)?
> Very many thanks in advance,
Not without using ruby. You could jump to script/console and delete
the comments.
$ script/console
>> comments = Comment.find(:all, :conditions => ['created_at > ?', Time.utc(2008, 7, 1, 15, 0, 0)])
That should finds comments posted after July 1st, 2008, at 3pm. I'd
take a look at the comments first before doing anything hasty:
>> comments.map { |c| c.body }
Depending on how many comments you have, you may want to slice the array:
>> comments[0..15].map { |c| c.body }
>> comments[16..30].map { |c| c.body }
Then you can delete them with:
>> Comment.transaction do
comments.each { |c| c.destroy }
end
It's probably best to run a backup of your database before you do
anything major, though.
--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com