diff --git a/composer.json b/composer.json index 60094d5bd..9a86ebc2c 100644 --- a/composer.json +++ b/composer.json @@ -77,6 +77,12 @@ "npm-asset/textcomplete": "^0.18.2", "npm-asset/typeahead.js": "^0.11.1" }, + "suggest": { + "ext-imagick": "For faster image processing", + "ext-redis": "To use Redis as a locking or caching provider", + "ext-pdo": "To use PDO as a database driver, has priority over mysqli unless database.disable_pdo is set", + "ext-mysqli": "To use mysqli as a databse driver" + }, "repositories": [ { "type": "vcs", diff --git a/src/Core/Cache/Type/RedisCache.php b/src/Core/Cache/Type/RedisCache.php index be2a7ff08..a6ce7c44b 100644 --- a/src/Core/Cache/Type/RedisCache.php +++ b/src/Core/Cache/Type/RedisCache.php @@ -57,22 +57,27 @@ class RedisCache extends AbstractCache implements ICanCacheInMemory $redis_host = $config->get('system', 'redis_host'); $redis_port = $config->get('system', 'redis_port'); $redis_pw = $config->get('system', 'redis_password'); - $redis_db = $config->get('system', 'redis_db', 0); + $redis_db = (int)$config->get('system', 'redis_db', 0); try { - - if (!empty($redis_port) && !@$this->redis->connect($redis_host, $redis_port)) { - throw new CachePersistenceException('Expected Redis server at ' . $redis_host . ':' . $redis_port . ' isn\'t available'); - } else if (!@$this->redis->connect($redis_host)) { - throw new CachePersistenceException('Expected Redis server at ' . $redis_host . ' isn\'t available'); + if (is_numeric($redis_port) && $redis_port > -1) { + $connection_string = $redis_host . ':' . $redis_port; + if (!@$this->redis->connect($redis_host, $redis_port)) { + throw new CachePersistenceException('Expected Redis server at ' . $connection_string . " isn't available"); + } + } else { + $connection_string = $redis_host; + if (!@$this->redis->connect($redis_host)) { + throw new CachePersistenceException('Expected Redis server at ' . $connection_string . ' isn\'t available'); + } } if (!empty($redis_pw) && !$this->redis->auth($redis_pw)) { - throw new CachePersistenceException('Cannot authenticate redis server at ' . $redis_host . ':' . $redis_port); + throw new CachePersistenceException('Cannot authenticate redis server at ' . $connection_string); } if ($redis_db !== 0 && !$this->redis->select($redis_db)) { - throw new CachePersistenceException('Cannot switch to redis db ' . $redis_db . ' at ' . $redis_host . ':' . $redis_port); + throw new CachePersistenceException('Cannot switch to redis db ' . $redis_db . ' at ' . $connection_string); } } catch (\RedisException $exception) { throw new CachePersistenceException('Redis connection fails unexpectedly', $exception); diff --git a/static/defaults.config.php b/static/defaults.config.php index e8f44613c..6c9e2dd3c 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -543,11 +543,11 @@ return [ 'pushpoll_frequency' => 3, // redis_host (String) - // Host name of the redis daemon. + // Host name or the path to the Unix domain socket of the Redis daemon. 'redis_host' => '127.0.0.1', - // redis_port (String) - // Port number of the redis daemon. + // redis_port (Integer) + // Port number of the Redis daemon, should be -1 for unix domain socket 'redis_port' => 6379, // redis_db (Integer)