From 8f1d96e86f40b12a71478a162b2a71cbbce8f7ec Mon Sep 17 00:00:00 2001 From: djmaze Date: Mon, 23 Aug 2021 11:50:27 +0200 Subject: [PATCH] Revert #113 and #116 with a compatibility fix --- .../app/libraries/MailSo/Cache/Drivers/Redis.php | 14 ++++++-------- .../v/0.0.0/app/libraries/RainLoop/Actions.php | 3 ++- .../app/libraries/RainLoop/Config/Application.php | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Redis.php b/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Redis.php index bd2f5a2e2..53c5db0b9 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Redis.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Redis.php @@ -18,11 +18,6 @@ namespace MailSo\Cache\Drivers; */ class Redis implements \MailSo\Cache\DriverInterface { - /** - * @var string - */ - private $sUrl; - /** * @var int */ @@ -38,16 +33,19 @@ class Redis implements \MailSo\Cache\DriverInterface */ private $sKeyPrefix; - function __construct(string $sUrl = 'redis://127.0.0.1:6379', int $iExpire = 43200, string $sKeyPrefix = '') + + function __construct(string $sHost = '127.0.0.1', int $iPort = 6379, int $iExpire = 43200, string $sKeyPrefix = '') { - $this->sUrl = $sUrl; $this->iExpire = 0 < $iExpire ? $iExpire : 43200; $this->oRedis = null; try { - $this->oRedis = new \Predis\Client($sUrl); + $this->oRedis = new \Predis\Client(\strpos($sHost, ':/') ? $sHost : array( + 'host' => $sHost, + 'port' => $iPort + )); $this->oRedis->connect(); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index 2b0ead492..15457c2b4 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -706,7 +706,8 @@ class Actions case 'REDIS' === $sDriver && \class_exists('Predis\Client'): $oDriver = new \MailSo\Cache\Drivers\Redis( - $this->Config()->Get('labs', 'fast_cache_redis_url', 'tcp://127.0.0.1:6379'), + $this->Config()->Get('labs', 'fast_cache_redis_host', '127.0.0.1'), + (int) $this->Config()->Get('labs', 'fast_cache_redis_port', 6379), 43200, $sKey ); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 6e66b4045..f7276d522 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -367,7 +367,8 @@ Enables caching in the system'), 'http_client_ip_check_proxy' => array(false), 'fast_cache_memcache_host' => array('127.0.0.1'), 'fast_cache_memcache_port' => array(11211), - 'fast_cache_redis_url' => array('tcp://127.0.0.1:6379'), + 'fast_cache_redis_host' => array('127.0.0.1'), + 'fast_cache_redis_port' => array(6379), 'use_local_proxy_for_external_images' => array(true), 'detect_image_exif_orientation' => array(true), 'cookie_default_path' => array(''),