X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSession%2FCacheSessionHandler.php;h=c0a5896f4247a0f90330496df9c0f38ad305b9ca;hb=854cc3e47296d4a1b01b893376064cf254d84f79;hp=463fd33d3eff0d40de528b1446d64a892f9bef7d;hpb=5e5fde0a63c57d2873bfa29404110269ca9abeee;p=friendica.git diff --git a/src/Core/Session/CacheSessionHandler.php b/src/Core/Session/CacheSessionHandler.php index 463fd33d3e..c0a5896f42 100644 --- a/src/Core/Session/CacheSessionHandler.php +++ b/src/Core/Session/CacheSessionHandler.php @@ -4,16 +4,14 @@ namespace Friendica\Core\Session; use Friendica\BaseObject; use Friendica\Core\Cache; +use Friendica\Core\Logger; use Friendica\Core\Session; use SessionHandlerInterface; -require_once 'boot.php'; -require_once 'include/text.php'; - /** * SessionHandler using Friendica Cache * - * @author Hypolite Petovan + * @author Hypolite Petovan */ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface { @@ -24,7 +22,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface public function read($session_id) { - if (!x($session_id)) { + if (empty($session_id)) { return ''; } @@ -33,7 +31,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface Session::$exists = true; return $data; } - logger("no data for session $session_id", LOGGER_TRACE); + Logger::log("no data for session $session_id", Logger::TRACE); return ''; } @@ -47,6 +45,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface * @param string $session_id Session ID with format: [a-z0-9]{26} * @param string $session_data Serialized session data * @return boolean Returns false if parameters are missing, true otherwise + * @throws \Exception */ public function write($session_id, $session_data) { @@ -58,9 +57,9 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface return true; } - Cache::set('session:' . $session_id, $session_data, Session::$expire); + $return = Cache::set('session:' . $session_id, $session_data, Session::$expire); - return true; + return $return; } public function close() @@ -70,8 +69,9 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface public function destroy($id) { - Cache::delete('session:' . $id); - return true; + $return = Cache::delete('session:' . $id); + + return $return; } public function gc($maxlifetime)