Fix Redis test

- Check if $redis_port is null
This commit is contained in:
Philipp Holzer 2019-08-13 08:32:08 +02:00
parent 3480891277
commit 31cfac1cfa
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90

View file

@ -37,8 +37,10 @@ class RedisCache extends Cache implements IMemoryCache
$redis_pw = $config->get('system', 'redis_password');
$redis_db = $config->get('system', 'redis_db', 0);
if (!$this->redis->connect($redis_host, $redis_port)) {
if (isset($redis_port) && !$this->redis->connect($redis_host, $redis_port)) {
throw new Exception('Expected Redis server at ' . $redis_host . ':' . $redis_port . ' isn\'t available');
} elseif (!$this->redis->connect($redis_host)) {
throw new Exception('Expected Redis server at ' . $redis_host . ' isn\'t available');
}
if (isset($redis_pw) && !$this->redis->auth($redis_pw)) {