Skip to content

Commit dcd0370

Browse files
committed
fixing laravel 5 PhpRedisConnection
1 parent 165ec41 commit dcd0370

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

.travis.yml

+25-27
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ dist: trusty
33
sudo: false
44

55
php:
6-
# - 5.6
6+
- 5.6
77
- 7.0
8-
# - 7.1
9-
# - 7.2
10-
# - 7.3
11-
# - 7.4
8+
- 7.1
9+
- 7.2
10+
- 7.3
11+
- 7.4
1212

1313
env:
14-
# - LARAVEL_VERSION=">=5.4.0 <5.4.20"
15-
# - LARAVEL_VERSION=">=5.4.20 <5.5.0"
16-
# - LARAVEL_VERSION="5.5.*"
17-
# - LARAVEL_VERSION="5.5.*" HORIZON=1
18-
# - LARAVEL_VERSION="5.6.*"
19-
# - LARAVEL_VERSION="5.6.*" HORIZON=1
20-
# - LARAVEL_VERSION="5.7.*"
21-
# - LARAVEL_VERSION="5.7.*" HORIZON=1
22-
# - LARAVEL_VERSION="5.8.*"
23-
# - LARAVEL_VERSION="5.8.*" HORIZON=1
14+
- LARAVEL_VERSION=">=5.4.0 <5.4.20"
15+
- LARAVEL_VERSION=">=5.4.20 <5.5.0"
16+
- LARAVEL_VERSION="5.5.*"
17+
- LARAVEL_VERSION="5.5.*" HORIZON=1
18+
- LARAVEL_VERSION="5.6.*"
19+
- LARAVEL_VERSION="5.6.*" HORIZON=1
20+
- LARAVEL_VERSION="5.7.*"
21+
- LARAVEL_VERSION="5.7.*" HORIZON=1
22+
- LARAVEL_VERSION="5.8.*"
23+
- LARAVEL_VERSION="5.8.*" HORIZON=1
2424
- LARAVEL_VERSION="6.*"
25-
# - LARAVEL_VERSION="6.*" HORIZON=1
26-
# - LARAVEL_VERSION="7.*"
27-
# - LARAVEL_VERSION="7.*" HORIZON=1
28-
# - LUMEN_VERSION="5.4.*"
29-
# - LUMEN_VERSION="5.5.*"
30-
# - LUMEN_VERSION="5.6.*"
31-
# - LUMEN_VERSION="5.7.*"
32-
# - LUMEN_VERSION="5.8.*"
33-
# - LUMEN_VERSION="6.*"
34-
# - LUMEN_VERSION="7.*"
25+
- LARAVEL_VERSION="6.*" HORIZON=1
26+
- LARAVEL_VERSION="7.*"
27+
- LARAVEL_VERSION="7.*" HORIZON=1
28+
- LUMEN_VERSION="5.4.*"
29+
- LUMEN_VERSION="5.5.*"
30+
- LUMEN_VERSION="5.6.*"
31+
- LUMEN_VERSION="5.7.*"
32+
- LUMEN_VERSION="5.8.*"
33+
- LUMEN_VERSION="6.*"
34+
- LUMEN_VERSION="7.*"
3535

3636
matrix:
3737
exclude:
@@ -126,8 +126,6 @@ before_install:
126126
- if [ -n "$LUMEN_VERSION" ]; then composer require --no-update "laravel/lumen-framework:$LUMEN_VERSION"; fi
127127
- if [ -z "$HORIZON" ]; then composer remove --dev --no-update "laravel/horizon"; fi
128128
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then printf "\n" | pecl install -f redis; fi
129-
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then phpenv config-rm xdebug.ini; fi
130-
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
131129

132130
install: travis_retry composer install --prefer-dist --no-interaction --no-suggest
133131

src/Connections/PhpRedisConnection.php

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
*/
2323
class PhpRedisConnection extends LaravelPhpRedisConnection
2424
{
25+
/**
26+
* The connection creation callback.
27+
*
28+
* Laravel 5 does not store the connector by default.
29+
*
30+
* @var callable
31+
*/
32+
protected $connector;
33+
2534
/**
2635
* The number of times the client attempts to retry a command when it fails
2736
* to connect to a Redis instance behind Sentinel.
@@ -50,6 +59,11 @@ public function __construct($client, callable $connector = null, array $sentinel
5059
{
5160
parent::__construct($client, $connector);
5261

62+
// Set the connector when it is not set. Used for Laravel 5.
63+
if (! $this->connector) {
64+
$this->connector = $connector;
65+
}
66+
5367
$this->retryLimit = (int) (isset($sentinelOptions['retry_limit']) ? $sentinelOptions['retry_limit'] : 20);
5468
$this->retryWait = (int) (isset($sentinelOptions['retry_wait']) ? $sentinelOptions['retry_wait'] : 1000);
5569
}

0 commit comments

Comments
 (0)