Fixed some timing problems as well as a bug that moved expired content to the trash unexpectedly.

This commit is contained in:
JT Smith 2003-01-22 01:37:17 +00:00
parent dd32a855f1
commit 790ced95b6
5 changed files with 14 additions and 6 deletions

View file

@ -1,7 +1,5 @@
package Hourly::TrashExpiredContent;
my $offset = 0; # in seconds, time to wait before deleting
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black LLC.
#-------------------------------------------------------------------
@ -13,13 +11,18 @@ my $offset = 0; # in seconds, time to wait before deleting
#-------------------------------------------------------------------
use strict;
use WebGUI::DateTime;
use WebGUI::Session;
use WebGUI::SQL;
#-----------------------------------------
sub process {
WebGUI::SQL->write("update page set parentId=3, endDate=endDate+31536000 where endDate<".(time()-(86400*$offset)));
WebGUI::SQL->write("update wobject set pageId=3, endDate=endDate+31536000 where endDate<".(time()-(86400*$offset)));
my $offset = $session{config}{TrashExpiredContent_offset};
if ($offset ne "") {
my $epoch = time()-(86400*$offset);
WebGUI::SQL->write("update page set parentId=3, endDate=endDate+31536000 where endDate<".$epoch);
WebGUI::SQL->write("update wobject set pageId=3, endDate=endDate+31536000 where endDate<".$epoch);
}
}
1;