public function SessionProxy_Storage_Database::read in Session Proxy 7
Overrides SessionProxy_Storage_Interface::read
File
- lib/
SessionProxy/ Storage/ Database.php, line 14
Class
Code
public function read($sessionId) {
global $user;
if (!isset($_COOKIE[$this->sessionName])) {
// Avoid a useless database query.
return '';
}
$data = db_query("SELECT u.uid, u.status, s.session FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(
':sid' => $sessionId,
))
->fetchObject();
if ($data && $data->uid > 0 && $data->status == 1) {
$this->uid = $data->uid;
$serializedData = $data->session;
}
else {
$serializedData = '';
}
$this
->sessionDataSetHash($sessionId, $serializedData);
return $serializedData;
}