webgui/sbin/Hourly/DeleteExpiredTrash.pm
JT Smith 637bd165ba - Any attempt to view "root" will redirect the user to the default page.
- fix [ 1285604 ] getVars undefined in Asset::File.pm
 - fix [ 1284330 ] error in page export function
 - Fixed a trash purging problem.
 - fix [ 1281516 ] Undefined subroutine &WebGUI::Asset::File::quote runHourly
 - fix [ 1281430 ] www_restoreList should be in AssetTrash.pm
2005-09-09 23:07:34 +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->purgeTree;
}
$sth->finish;
}
}
1;