Permalink
Browse files

MDL-25907 purge sessions of not-logged-in users

  • Loading branch information...
Ashley Holman authored and skodak committed Jan 12, 2011
1 parent 5a7f931 commit d0c3f54770c27a249e0c87b4e5f3dc1f841b3ef8
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/sessionlib.php
View
@@ -751,6 +751,9 @@ function session_gc() {
$DB->delete_records('sessions', array('sid'=>$user->sid));
}
$rs->close();
+
+ // delete expired sessions for userid = 0 (not logged in)
+ $DB->delete_records_select('sessions', 'userid = 0 AND timemodified < ?', array(time() - $maxlifeitme));
} catch (dml_exception $ex) {
error_log('Error gc-ing sessions');
}

0 comments on commit d0c3f54

Please sign in to comment.