Skip to content
Snippets Groups Projects
Commit 03d17af3 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #2988 from protich/issue/dbsession


Session: Create SessionData object on demand

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents f3a4bf53 2365afb9
No related branches found
No related tags found
No related merge requests found
...@@ -174,6 +174,8 @@ extends VerySimpleModel { ...@@ -174,6 +174,8 @@ extends VerySimpleModel {
class DbSessionBackend class DbSessionBackend
extends SessionBackend { extends SessionBackend {
var $data = null;
function read($id) { function read($id) {
try { try {
$this->data = SessionData::objects()->filter([ $this->data = SessionData::objects()->filter([
...@@ -200,7 +202,9 @@ extends SessionBackend { ...@@ -200,7 +202,9 @@ extends SessionBackend {
$ttl = $this && method_exists($this, 'getTTL') $ttl = $this && method_exists($this, 'getTTL')
? $this->getTTL() : SESSION_TTL; ? $this->getTTL() : SESSION_TTL;
assert($this->data->session_id == $id); // Create a session data obj if not loaded.
if (!isset($this->data))
$this->data = new SessionData(['session_id' => $id]);
$this->data->session_data = $data; $this->data->session_data = $data;
$this->data->session_expire = $this->data->session_expire =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment