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

Commitc38c3e7

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

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
@@ -151,7 +151,7 @@ public static function prefix($namespace)
151151
* DSN-supplied value will be used instead and this parameter is ignored.
152152
* @param object $client Optional Credis_Cluster or Credis_Client instance instantiated by you
153153
*/
154-
publicfunction__construct($server,$database =null,$client =null)
154+
publicfunction__construct($server,$database =null,$client =null,$auth =null)
155155
{
156156
try {
157157
if (is_object($client)) {
@@ -172,7 +172,7 @@ public function __construct($server, $database = null, $client = null)
172172
$this->driver =newCredis_Client($host,$port,$timeout,$persistent);
173173
$this->driver->setMaxConnectRetries($maxRetries);
174174
if ($password) {
175-
$this->driver->auth($password);
175+
$auth =$password;
176176
}
177177

178178
// If we have found a database in our DSN, use it instead of the `$database`
@@ -182,6 +182,10 @@ public function __construct($server, $database = null, $client = null)
182182
}
183183
}
184184

185+
if ($auth !==null) {
186+
$this->driver->auth($auth);
187+
}
188+
185189
if ($database !==null) {
186190
$this->driver->select($database);
187191
}

‎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