Fixed some timing problems as well as a bug that moved expired content to the trash unexpectedly.
This commit is contained in:
parent
dd32a855f1
commit
790ced95b6
5 changed files with 14 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ package Hourly::CleanLoginHistory;
|
|||
|
||||
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ package Hourly::DeleteExpiredEvents;
|
|||
|
||||
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package Hourly::DeleteExpiredGroupings;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue