September 4, 2004

Comment spam

Latest anti-spam measure:

UPDATE mt_entry SET entry_allow_comments = 2 WHERE entry_blog_id=1 AND entry_created_on < date(current_timestamp) - '7 days'::interval

... turning off comments on posts older than 7 days. I just need to work out how to get this into a cron job now ...

Posted by savs at September 4, 2004 1:39 PM
Comments

Not sure what DB engine you use, but in MySQL, it's easy. Just make your cron task do this:

echo "UPDATE mt_entry SET entry_allow_comments = 2 WHERE entry_blog_id=1 AND entry_created_on < date(current_timestamp) - '7 days'::interval" | mysql -uusername -ppassword database_name

Posted by: Ryan Schmidt at September 8, 2004 2:44 PM

I'm using postgres ... which seems to be fussy about reading passwords from the command line (it will prompt, but won't take it as a parameter).

Posted by: Andrew Savory at September 8, 2004 2:58 PM