#!/usr/local/bin/perl -w # # usage: ./blog_close_comments.pl $|=1; use strict; use DBIx::DWIW; use Blog::DBI; my $dbg = $ENV{DEBUG}; my $days = shift || 5; my $conn = Blog::DBI->connect() or die "$!"; my $update_sql = qq[ update mt_entry set entry_allow_comments = 2 where entry_created_on <= date_sub(CURDATE(), interval $days day) and entry_allow_comments <> 2 ]; my $update_sth= $conn->Prepare($update_sql); my $ret = $update_sth->Execute(); print "Comments have been closed on $ret blog entries.\n" if $dbg; exit;