File tree 2 files changed +46
-12
lines changed
2 files changed +46
-12
lines changed Original file line number Diff line number Diff line change @@ -206,13 +206,30 @@ protected function build_cluster_connection_array() {
206
206
$ cluster = array_values ( WP_REDIS_CLUSTER );
207
207
208
208
foreach ( $ cluster as $ key => $ server ) {
209
- $ connection_string = parse_url ( $ server );
209
+ $ components = parse_url ( $ server );
210
+
211
+ if ( ! empty ( $ components ['scheme ' ] ) ) {
212
+ $ scheme = $ components ['scheme ' ];
213
+ } elseif ( defined ( 'WP_REDIS_SCHEME ' ) ) {
214
+ $ scheme = WP_REDIS_SCHEME ;
215
+ } else {
216
+ $ scheme = null ;
217
+ }
210
218
211
- $ cluster [ $ key ] = sprintf (
212
- "%s:%s " ,
213
- $ connection_string ['host ' ],
214
- $ connection_string ['port ' ]
215
- );
219
+ if ( isset ( $ scheme ) ) {
220
+ $ cluster [ $ key ] = sprintf (
221
+ '%s://%s:%d ' ,
222
+ $ scheme ,
223
+ $ components ['host ' ],
224
+ $ components ['port ' ]
225
+ );
226
+ } else {
227
+ $ cluster [ $ key ] = sprintf (
228
+ '%s:%d ' ,
229
+ $ components ['host ' ],
230
+ $ components ['port ' ]
231
+ );
232
+ }
216
233
}
217
234
218
235
return $ cluster ;
Original file line number Diff line number Diff line change @@ -3027,13 +3027,30 @@ protected function build_cluster_connection_array() {
3027
3027
$ cluster = array_values ( WP_REDIS_CLUSTER );
3028
3028
3029
3029
foreach ( $ cluster as $ key => $ server ) {
3030
- $ connection_string = parse_url ( $ server );
3030
+ $ components = parse_url ( $ server );
3031
3031
3032
- $ cluster [ $ key ] = sprintf (
3033
- "%s:%s " ,
3034
- $ connection_string ['host ' ],
3035
- $ connection_string ['port ' ]
3036
- );
3032
+ if ( ! empty ( $ components ['scheme ' ] ) ) {
3033
+ $ scheme = $ components ['scheme ' ];
3034
+ } elseif ( defined ( 'WP_REDIS_SCHEME ' ) ) {
3035
+ $ scheme = WP_REDIS_SCHEME ;
3036
+ } else {
3037
+ $ scheme = null ;
3038
+ }
3039
+
3040
+ if ( isset ( $ scheme ) ) {
3041
+ $ cluster [ $ key ] = sprintf (
3042
+ '%s://%s:%d ' ,
3043
+ $ scheme ,
3044
+ $ components ['host ' ],
3045
+ $ components ['port ' ]
3046
+ );
3047
+ } else {
3048
+ $ cluster [ $ key ] = sprintf (
3049
+ '%s:%d ' ,
3050
+ $ components ['host ' ],
3051
+ $ components ['port ' ]
3052
+ );
3053
+ }
3037
3054
}
3038
3055
3039
3056
return $ cluster ;
You can’t perform that action at this time.
0 commit comments