function _drupal_session_garbage_collection

Session handler assigned by session_set_save_handler().

Cleans up stalled sessions.

Parameters

$lifetime: The value of session.gc_maxlifetime, passed by PHP. Sessions not updated for more than $lifetime seconds will be removed.

1 string reference to '_drupal_session_garbage_collection'
drupal_session_initialize in includes/session.inc
Initializes the session handler, starting a session if needed.

File

includes/session.inc, line 567

Code

function _drupal_session_garbage_collection($lifetime) {
    // Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
    // value. For example, if you want user sessions to stay in your database
    // for three weeks before deleting them, you need to set gc_maxlifetime
    // to '1814400'. At that value, only after a user doesn't log in after
    // three weeks (1814400 seconds) will his/her session be removed.
    db_delete('sessions')->condition('timestamp', REQUEST_TIME - $lifetime, '<')
        ->execute();
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.