X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSession%2FHandler%2FDatabase.php;h=41ccb6b33f834e4f315fef4b6b78a5f2813bebff;hb=2edbd1a3e2b90430b378de32f79a7cbd3537d9de;hp=714471f9fe7cd628158f804409a56831c641d959;hpb=940619325d9b2109d90b40347607302ebd944bd9;p=friendica.git diff --git a/src/Core/Session/Handler/Database.php b/src/Core/Session/Handler/Database.php index 714471f9fe..41ccb6b33f 100644 --- a/src/Core/Session/Handler/Database.php +++ b/src/Core/Session/Handler/Database.php @@ -21,15 +21,13 @@ namespace Friendica\Core\Session\Handler; -use Friendica\Core\Session; use Friendica\Database\Database as DBA; use Psr\Log\LoggerInterface; -use SessionHandlerInterface; /** * SessionHandler using database */ -class Database implements SessionHandlerInterface +class Database extends AbstractSessionHandler { /** @var DBA */ private $dba; @@ -37,6 +35,8 @@ class Database implements SessionHandlerInterface private $logger; /** @var array The $_SERVER variable */ private $server; + /** @var bool global check, if the current Session exists */ + private $sessionExists = false; /** * DatabaseSessionHandler constructor. @@ -66,7 +66,7 @@ class Database implements SessionHandlerInterface try { $session = $this->dba->selectFirst('session', ['data'], ['sid' => $id]); if ($this->dba->isResult($session)) { - Session::$exists = true; + $this->sessionExists = true; return $session['data']; } } catch (\Exception $exception) { @@ -101,11 +101,11 @@ class Database implements SessionHandlerInterface return $this->destroy($id); } - $expire = time() + Session::$expire; + $expire = time() + static::EXPIRE; $default_expire = time() + 300; try { - if (Session::$exists) { + if ($this->sessionExists) { $fields = ['data' => $data, 'expire' => $expire]; $condition = ["`sid` = ? AND (`data` != ? OR `expire` != ?)", $id, $data, $expire]; $this->dba->update('session', $fields, $condition);