Revert "Make session handler pluggable"

This reverts commit 8972ca8134
This commit is contained in:
Mario 2019-01-29 21:16:38 +01:00
parent cd4d90c647
commit 913b620c66

View File

@ -15,7 +15,6 @@ class Session {
private $handler = null; private $handler = null;
private $session_started = false; private $session_started = false;
private $custom_handler = false;
public function init() { public function init() {
@ -29,20 +28,13 @@ class Session {
* Set our session storage functions. * Set our session storage functions.
*/ */
$custom_handler = $this->custom_handler; $handler = new \Zotlabs\Web\SessionHandler();
call_hook('custom_session_handler',$custom_handler);
$this->custom_handler = $custom_handler;
$this->handler = $handler;
if (!$this->custom_handler) { $x = session_set_save_handler($handler,false);
$handler = new \Zotlabs\Web\SessionHandler(); if(! $x)
logger('Session save handler initialisation failed.',LOGGER_NORMAL,LOG_ERR);
$this->handler = $handler;
$x = session_set_save_handler($handler,false);
if(! $x)
logger('Session save handler initialisation failed.',LOGGER_NORMAL,LOG_ERR);
}
// Force cookies to be secure (https only) if this site is SSL enabled. // Force cookies to be secure (https only) if this site is SSL enabled.
// Must be done before session_start(). // Must be done before session_start().
@ -94,17 +86,14 @@ class Session {
$arr = session_get_cookie_params(); $arr = session_get_cookie_params();
if(($this->handler || $this->custom_handler) && $this->session_started) { if($this->handler && $this->session_started) {
session_regenerate_id(true); session_regenerate_id(true);
if (!$this->custom_handler) { // force SessionHandler record creation with the new session_id
// force SessionHandler record creation with the new session_id // which occurs as a side effect of read()
// which occurs as a side effect of read() since not all implementations
// of session_regenerate_id() call read().
$this->handler->read(session_id()); $this->handler->read(session_id());
}
} }
else else
logger('no session handler'); logger('no session handler');