upgrade to laravel 8.0

This commit is contained in:
Attila Kerekes
2022-11-13 17:05:03 +01:00
committed by Attila Jozsef Kerekes
parent 43f894b58d
commit 27f58c0866
3895 changed files with 150576 additions and 124482 deletions

View File

@@ -179,7 +179,7 @@ trait RedisTrait
}
if (null === $params['class'] && \extension_loaded('redis')) {
$class = $params['redis_cluster'] ? \RedisCluster::class : (1 < \count($hosts) ? \RedisArray::class : \Redis::class);
$class = $params['redis_cluster'] ? \RedisCluster::class : (1 < \count($hosts) && !isset($params['redis_sentinel']) ? \RedisArray::class : \Redis::class);
} else {
$class = $params['class'] ?? \Predis\Client::class;
@@ -193,21 +193,29 @@ trait RedisTrait
$redis = new $class();
$initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts, $tls) {
$host = $hosts[0]['host'] ?? $hosts[0]['path'];
$port = $hosts[0]['port'] ?? 0;
$hostIndex = 0;
do {
$host = $hosts[$hostIndex]['host'] ?? $hosts[$hostIndex]['path'];
$port = $hosts[$hostIndex]['port'] ?? 0;
$address = false;
if (isset($hosts[0]['host']) && $tls) {
$host = 'tls://'.$host;
}
if (isset($params['redis_sentinel'])) {
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
if (!$address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
throw new InvalidArgumentException(sprintf('Failed to retrieve master information from master name "%s" and address "%s:%d".', $params['redis_sentinel'], $host, $port));
if (isset($hosts[$hostIndex]['host']) && $tls) {
$host = 'tls://'.$host;
}
[$host, $port] = $address;
if (!isset($params['redis_sentinel'])) {
break;
}
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
[$host, $port] = $address;
}
} while (++$hostIndex < \count($hosts) && !$address);
if (isset($params['redis_sentinel']) && !$address) {
throw new InvalidArgumentException(sprintf('Failed to retrieve master information from sentinel "%s" and dsn "%s".', $params['redis_sentinel'], $dsn));
}
try {