diff --git a/sbin/Hourly/CleanLoginHistory.pm b/sbin/Hourly/CleanLoginHistory.pm index d0a05458e..c477907a1 100644 --- a/sbin/Hourly/CleanLoginHistory.pm +++ b/sbin/Hourly/CleanLoginHistory.pm @@ -12,6 +12,7 @@ package Hourly::CleanLoginHistory; use strict; +use WebGUI::DateTime; use WebGUI::Session; use WebGUI::SQL; diff --git a/sbin/Hourly/DeleteExpiredEvents.pm b/sbin/Hourly/DeleteExpiredEvents.pm index 7063afdbb..386c2e970 100644 --- a/sbin/Hourly/DeleteExpiredEvents.pm +++ b/sbin/Hourly/DeleteExpiredEvents.pm @@ -12,6 +12,7 @@ package Hourly::DeleteExpiredEvents; use strict; +use WebGUI::DateTime; use WebGUI::Session; use WebGUI::SQL; diff --git a/sbin/Hourly/DeleteExpiredGroupings.pm b/sbin/Hourly/DeleteExpiredGroupings.pm index d352b8714..8a74b8e86 100644 --- a/sbin/Hourly/DeleteExpiredGroupings.pm +++ b/sbin/Hourly/DeleteExpiredGroupings.pm @@ -11,6 +11,7 @@ package Hourly::DeleteExpiredGroupings; #------------------------------------------------------------------- use strict; +use WebGUI::DateTime; use WebGUI::Session; use WebGUI::SQL; diff --git a/sbin/Hourly/DeleteExpiredSessions.pm b/sbin/Hourly/DeleteExpiredSessions.pm index b8c61889d..c2d5735fb 100644 --- a/sbin/Hourly/DeleteExpiredSessions.pm +++ b/sbin/Hourly/DeleteExpiredSessions.pm @@ -11,17 +11,19 @@ package Hourly::DeleteExpiredSessions; #------------------------------------------------------------------- use strict; +use WebGUI::DateTime; use WebGUI::Session; use WebGUI::SQL; #------------------------------------------------------------------- sub process { - my $sth = WebGUI::SQL->read("select sessionId from userSession where expires<".time()); + my $epoch = time(); + my $sth = WebGUI::SQL->read("select sessionId from userSession where expires<".$epoch); while (my ($sessionId) = $sth->array) { WebGUI::SQL->write("delete from userSessionScratch where sessionId=".quote($sessionId)); } $sth->finish; - WebGUI::SQL->write("delete from userSession where expires<".time()); + WebGUI::SQL->write("delete from userSession where expires<".$epoch); } 1; diff --git a/sbin/Hourly/TrashExpiredContent.pm b/sbin/Hourly/TrashExpiredContent.pm index eff0cb3be..f998f7f3d 100644 --- a/sbin/Hourly/TrashExpiredContent.pm +++ b/sbin/Hourly/TrashExpiredContent.pm @@ -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;