Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-05-15 06:28:49 +10:00
commit 44cad852ca
3 changed files with 17 additions and 18 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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]