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
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue