function session_api_cron in Session API 7
Same name and namespace in other branches
- 5 session_api.module \session_api_cron()
- 6 session_api.module \session_api_cron()
Implements hook_cron().
File
- ./
session_api.module, line 115 - Session API provides an interface for storing information in the session.
Code
function session_api_cron() {
// Fetch list of outdated sids.
$query = db_select('session_api', 'sap');
$query
->fields('sap', array(
'sid',
));
$query
->condition('sap.timestamp', REQUEST_TIME - variable_get('session_api_cookie_purge_time', 2592000), '<');
$outdated_sids = $query
->execute()
->fetchCol();
if (!empty($outdated_sids)) {
module_invoke_all('session_api_cleanup', $outdated_sids);
db_delete('session_api')
->condition('sid', $outdated_sids)
->execute();
}
}