webgui/sbin/Hourly/DeleteExpiredEvents.pm
2005-04-05 13:32:22 +00:00

32 lines
1 KiB
Perl

package Hourly::DeleteExpiredEvents;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::DateTime;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Asset::Event;
#-----------------------------------------
sub process {
if ($session{config}{DeleteExpiredEvents_offset} ne "") {
my $sth = WebGUI::SQL->read("select assetId from EventsCalendar_event where eventEndDate < ".(time()-(86400*$session{config}{DeleteExpiredEvents_offset})));
while (my ($id) = $sth->array) {
WebGUI::Asset::Event->new($id)->purge;
}
$sth->finish;
}
}
1;