X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSession%2FDatabaseSessionHandler.php;h=9bb1180ec1956aa6d1d8d2127c52e1464f41aeba;hb=64847e7cc8ca8f157cae4994c71b93df28624d6f;hp=f9ceaabaf1910bd356f0a96aff3dfb44429cd375;hpb=af6dbc654f82225cfc647fe2072662acae388e47;p=friendica.git diff --git a/src/Core/Session/DatabaseSessionHandler.php b/src/Core/Session/DatabaseSessionHandler.php index f9ceaabaf1..9bb1180ec1 100644 --- a/src/Core/Session/DatabaseSessionHandler.php +++ b/src/Core/Session/DatabaseSessionHandler.php @@ -3,19 +3,15 @@ namespace Friendica\Core\Session; use Friendica\BaseObject; +use Friendica\Core\Logger; use Friendica\Core\Session; use Friendica\Database\DBA; -use Friendica\Database\DBM; use SessionHandlerInterface; -require_once 'boot.php'; -require_once 'include/dba.php'; -require_once 'include/text.php'; - /** * SessionHandler using database * - * @author Hypolite Petovan + * @author Hypolite Petovan */ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterface { @@ -26,16 +22,16 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa public function read($session_id) { - if (!x($session_id)) { + if (empty($session_id)) { return ''; } $session = DBA::selectFirst('session', ['data'], ['sid' => $session_id]); - if (DBM::is_result($session)) { + if (DBA::isResult($session)) { Session::$exists = true; return $session['data']; } - logger("no data for session $session_id", LOGGER_TRACE); + Logger::log("no data for session $session_id", Logger::TRACE); return ''; } @@ -50,6 +46,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa * @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) {