MDL-26031 purge timed-out sessions of guest user

This commit is contained in:
Petr Skoda 2011-01-17 18:25:00 +01:00
parent 9498654c1d
commit 673a8f7781

View File

@ -752,8 +752,11 @@ function session_gc() {
}
$rs->close();
$purgebefore = time() - $maxlifetime;
// delete expired sessions for guest user account
$DB->delete_records_select('sessions', 'userid = ? AND timemodified < ?', array($CFG->siteguest, $purgebefore));
// delete expired sessions for userid = 0 (not logged in)
$DB->delete_records_select('sessions', 'userid = 0 AND timemodified < ?', array(time() - $maxlifetime));
$DB->delete_records_select('sessions', 'userid = 0 AND timemodified < ?', array($purgebefore));
} catch (dml_exception $ex) {
error_log('Error gc-ing sessions');
}