Skip to content

Commit

Permalink
MDL-25907 purge sessions of not-logged-in users
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Holman authored and skodak committed Jan 12, 2011
1 parent 5a7f931 commit d0c3f54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sessionlib.php
Expand Up @@ -751,6 +751,9 @@ function session_gc() {
$DB->delete_records('sessions', array('sid'=>$user->sid)); $DB->delete_records('sessions', array('sid'=>$user->sid));
} }
$rs->close(); $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) { } catch (dml_exception $ex) {
error_log('Error gc-ing sessions'); error_log('Error gc-ing sessions');
} }
Expand Down

0 comments on commit d0c3f54

Please sign in to comment.