Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5bbe8f2

Browse files
jasverixdanhunsaker
authored andcommitted
fix(auth): selecting database before auth caused error
1 parentb3131f2 commit5bbe8f2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎lib/Redis.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function prefix($namespace)
125125
* DSN-supplied value will be used instead and this parameter is ignored.
126126
* @param object $client Optional Credis_Cluster or Credis_Client instance instantiated by you
127127
*/
128-
publicfunction__construct($server,$database =null,$client =null)
128+
publicfunction__construct($server,$database =null,$client =null,$auth =null)
129129
{
130130
try {
131131
if (is_object($client)) {
@@ -146,7 +146,7 @@ public function __construct($server, $database = null, $client = null)
146146
$this->driver =newCredis_Client($host,$port,$timeout,$persistent);
147147
$this->driver->setMaxConnectRetries($maxRetries);
148148
if ($password) {
149-
$this->driver->auth($password);
149+
$auth =$password;
150150
}
151151

152152
// If we have found a database in our DSN, use it instead of the `$database`
@@ -156,6 +156,10 @@ public function __construct($server, $database = null, $client = null)
156156
}
157157
}
158158

159+
if ($auth !==null) {
160+
$this->driver->auth($auth);
161+
}
162+
159163
if ($database !==null) {
160164
$this->driver->select($database);
161165
}

‎lib/Resque.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function redis()
7272
if (is_callable(self::$redisServer)) {
7373
self::$redis =call_user_func(self::$redisServer,self::$redisDatabase);
7474
}else {
75-
self::$redis =newRedis(self::$redisServer,self::$redisDatabase);
75+
self::$redis =newRedis(self::$redisServer,self::$redisDatabase,null,self::$auth);
7676
}
7777

7878
if (!empty(self::$auth)) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp