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

@ -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;