diff --git a/src/Lib/ActivityPub.php b/src/Lib/ActivityPub.php index 17fabf274..f43462812 100644 --- a/src/Lib/ActivityPub.php +++ b/src/Lib/ActivityPub.php @@ -129,11 +129,6 @@ class ActivityPub } foreach ($r as $contact) { - // is $contact connected with this channel - and if the channel is cloned, also on this hub? - // 2018-10-19 this probably doesn't apply to activitypub anymore, just send the thing. - // They'll reject it if they don't like it. - // $single = deliverable_singleton($arr['channel']['channel_id'],$contact); - if (!$arr['normal_mode']) { continue; } diff --git a/src/Web/Session.php b/src/Web/Session.php index 52be8d318..d6de4a31d 100644 --- a/src/Web/Session.php +++ b/src/Web/Session.php @@ -39,6 +39,7 @@ class Session * Set our session storage functions. */ + $handler = null; if ($this->custom_handler) { /* Custom handler (files, memached, redis..) */ @@ -48,11 +49,12 @@ class Session } else { logger('Session save handler or path not set.', LOGGER_NORMAL, LOG_ERR); } - } else { - if (!empty($session_save_handler) && $session_save_handler === 'Redis' - && $session_save_path) { + } + else { + if (!empty($session_save_handler) && $session_save_handler === 'Redis' && $session_save_path) { $handler = new SessionRedis($session_save_path); - } else { + } + if (!$handler || !$handler->connected) { $handler = new SessionHandler(); } $this->handler = $handler; diff --git a/src/Web/SessionRedis.php b/src/Web/SessionRedis.php index e2c206212..fd8b88995 100644 --- a/src/Web/SessionRedis.php +++ b/src/Web/SessionRedis.php @@ -9,6 +9,7 @@ use RedisException; class SessionRedis implements SessionHandlerInterface { private $redis = null; + public $connected = false; function __construct($connection) { @@ -19,7 +20,6 @@ class SessionRedis implements SessionHandlerInterface { try { if (isset($credentials['path'])) { $this->redis->connect($credentials['path']); - logger('redis connected - path'); } else { if (isset($credentials['query'])) { @@ -28,15 +28,13 @@ class SessionRedis implements SessionHandlerInterface { else { $vars = []; } - $this->redis->connect( - ($credentials['host']), - (isset($credentials['port']) ? $credentials['port'] : 6379), - (isset($vars['timeout']) ? $vars['timeout'] : 1), - null, - 0, - (isset($vars['read_timeout']) ? $vars['read_timeout'] : 0) + $this->redis->connect($credentials['host'], + ($credentials['port'] ?? 6379), + ($vars['timeout'] ?? 1), + null, + 0, + ($vars['read_timeout'] ?? 0) ); - logger('redis connected'); if (isset($vars['auth'])) { $this->redis->auth($vars['auth']); @@ -45,7 +43,11 @@ class SessionRedis implements SessionHandlerInterface { } catch(RedisException $ex) { logger('Error connecting to Redis: ' . $ex->getMessage()); + $this->connected = false; + return $this; } + $this->connected = true; + return $this; } #[\ReturnTypeWillChange]