22 lines
448 B
Perl
22 lines
448 B
Perl
|
#!/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;
|