webgui/sbin/Hourly/DeleteExpiredTrash.pm
JT Smith 2ca63a85fb - fix [ 1292597 ] Trash not emptied
- fix [ 1292209 ] purgeTree called in runHourly.pl (6.7.4)
 - fix [ 1290600 ] 6.6.5-6.7.0 upgrade script (fix) (Nicklous Roberts)
2005-09-19 18:47:51 +00:00

33 lines
1.1 KiB
Perl

package Hourly::DeleteExpiredTrash;
#-------------------------------------------------------------------
# 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::Asset;
use WebGUI::Session;
use WebGUI::SQL;
#-----------------------------------------
sub process {
if ($session{config}{DeleteExpiredTrash_offset} ne "") {
my $expireDate = (time()-(86400*$session{config}{DeleteExpiredTrash_offset}));
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='trash' and stateChanged <".$expireDate);
while (my ($id, $class) = $sth->array) {
my $asset = WebGUI::Asset->new($id,$class);
$asset->purgeBranch;
}
$sth->finish;
}
}
1;