function _drupal_session_read in Zircon Profile 8
Same name and namespace in other branches
- 8.0 modules/memcache/unstable/memcache-session.inc \_drupal_session_read()
1 string reference to '_drupal_session_read'
- drupal_session_initialize in modules/
memcache/ unstable/ memcache-session.inc - Initialize the session handler, starting a session if needed.
File
- modules/
memcache/ unstable/ memcache-session.inc, line 34
Code
function _drupal_session_read($key) {
global $user;
// Write and Close handlers are called after destructing objects since PHP 5.0.5
// Thus destructors can use sessions but session handler can't use objects.
// So we are moving session closure before destructing objects.
register_shutdown_function('session_write_close');
// Handle the case of first time visitors and clients that don't store
// cookies (eg. web crawlers).
if (!isset($_COOKIE[session_name()])) {
$user = drupal_anonymous_user();
return '';
}
// Otherwise, if the session is still active, we have a record of the
// client's session in memcache.
$session = dmemcache_get($key, 'session');
$user = _memcache_session_user_load($session);
// Record whether this session contains data so that in sess_write() it can
// be determined whether to skip a write.
$user->session_data_present_at_load = !empty($session->session);
return $user->session;
}