Skip to content

Commit

Permalink
Fixes assumption that CACHE_PORT & CACHE_PASSWORD are Set.
Browse files Browse the repository at this point in the history
* Falls back on port 6379 if the CACHE_PORT is not configured.
* Doesn't require a CACHE_PASSWORD to be set when it isn't used, or can't be.
  • Loading branch information
timnolte committed Jun 24, 2022
1 parent e825bc9 commit a884f66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,8 @@ public function build_client_parameters( $redis_server ) {
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379,
'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'], null,
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions wp-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function wp_redis_get_info() {
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? $_SERVER['CACHE_PORT'] : 6379,
'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'], null,
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
Expand Down

0 comments on commit a884f66

Please sign in to comment.