Permalink
Browse files

MDL-26031 purge timed-out sessions of guest user

  • Loading branch information...
1 parent 9498654 commit 673a8f7781efd742f5d031b012e711a16e149ee6 @skodak skodak committed Jan 17, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/sessionlib.php
View
5 lib/sessionlib.php
@@ -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');
}

0 comments on commit 673a8f7

Please sign in to comment.