MDL-46561 session: use full session validation in \core\session\manager::session_exists()

This commit is contained in:
Petr Skoda
2014-08-07 08:59:24 +12:00
parent d29fb4ac65
commit c6b5f18d06
8 changed files with 75 additions and 17 deletions
+4 -7
View File
@@ -82,19 +82,16 @@ class database extends handler {
}
/**
* Check for existing session with id $sid.
* Check the backend contains data for this session id.
*
* Note: this verifies the storage backend only, not the actual session records.
* Note: this is intended to be called from manager::session_exists() only.
*
* @param string $sid
* @return bool true if session found.
*/
public function session_exists($sid) {
try {
return $this->database->record_exists('sessions', array('sid'=>$sid, 'state'=>0));
} catch (\dml_exception $ex) {
return false;
}
// It was already checked in the calling code that the record in sessions table exists.
return true;
}
/**