File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ public function __construct($server, $database = null)
101
101
}
102
102
else {
103
103
$ port = null ;
104
+ $ password = null ;
104
105
$ host = $ server ;
105
106
106
107
// If not a UNIX socket path or tcp:// formatted connections string
@@ -111,8 +112,19 @@ public function __construct($server, $database = null)
111
112
$ port = $ parts [1 ];
112
113
}
113
114
$ host = $ parts [0 ];
115
+ }else if (strpos ($ server , 'redis:// ' ) !== false ){
116
+ // Redis format is:
117
+ // redis://[user]:[password]@[host]:[port]
118
+ list ($ userpwd ,$ hostport ) = explode ('@ ' , $ server );
119
+ $ userpwd = substr ($ userpwd , strpos ($ userpwd , 'redis:// ' )+8 );
120
+ list ($ host , $ port ) = explode (': ' , $ hostport );
121
+ list ($ user , $ password ) = explode (': ' , $ userpwd );
114
122
}
123
+
115
124
$ this ->driver = new Credis_Client ($ host , $ port );
125
+ if (isset ($ password )){
126
+ $ this ->driver ->auth ($ password );
127
+ }
116
128
}
117
129
118
130
if ($ this ->database !== null ) {
You can’t perform that action at this time.
0 commit comments