diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Memcache.php b/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Memcache.php index 713c5cd20..358f9b933 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Memcache.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Cache/Drivers/Memcache.php @@ -18,16 +18,6 @@ namespace MailSo\Cache\Drivers; */ class Memcache implements \MailSo\Cache\DriverInterface { - /** - * @var string - */ - private $sHost; - - /** - * @var int - */ - private $iPost; - /** * @var int */ @@ -43,14 +33,12 @@ class Memcache implements \MailSo\Cache\DriverInterface */ private $sKeyPrefix; - function __construct(string $sHost = '127.0.0.1', int $iPost = 11211, int $iExpire = 43200, string $sKeyPrefix = '') + function __construct(string $sHost = '127.0.0.1', int $iPort = 11211, int $iExpire = 43200, string $sKeyPrefix = '') { - $this->sHost = $sHost; - $this->iPost = $iPost; $this->iExpire = 0 < $iExpire ? $iExpire : 43200; - $this->oMem = new \Memcache; - if (!$this->oMem->connect($this->sHost, $this->iPost)) + $this->oMem = \class_exists('Memcache',false) ? new \Memcache : new \Memcached; + if (!$this->oMem->addServer($sHost, $this->iPort)) { $this->oMem = null; } 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 558f6e3d2..2b0ead492 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -694,11 +694,11 @@ class Actions break; case ('MEMCACHE' === $sDriver || 'MEMCACHED' === $sDriver) && - \MailSo\Base\Utils::FunctionExistsAndEnabled('memcache_connect'): - + (\class_exists('Memcache',false) || \class_exists('Memcached',false)): + $sHost = $this->Config()->Get('labs', 'fast_cache_memcache_host', '127.0.0.1'); $oDriver = new \MailSo\Cache\Drivers\Memcache( - $this->Config()->Get('labs', 'fast_cache_memcache_host', '127.0.0.1'), - (int)$this->Config()->Get('labs', 'fast_cache_memcache_port', 11211), + $sHost, + strpos($sHost, ':/') ? 0 : (int)$this->Config()->Get('labs', 'fast_cache_memcache_port', 11211), 43200, $sKey );