ljr/local/bin/maint/clean_challenges.pl

22 lines
448 B
Perl
Raw Normal View History

2019-02-05 21:49:12 +00:00
#!/usr/bin/perl
#
$maint{'clean_challenges'} = sub
{
my $dbh = LJ::get_db_writer();
my $sth;
my $ctime = time();
my $deltime = $ctime - 60*60*24*14; # two weeks
print "current time: $ctime\n";
print "deleting challenges older than: $deltime\n";
$sth = $dbh->prepare("delete from challenges where challenge < 'c0:$deltime'");
$sth->execute();
if ($dbh->err) { die $dbh->errstr; }
print "done.\n";
};
1;