From 2d838be17d0ec8c3d4860445fecaaeaccf86780d Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Fri, 6 Dec 2024 12:55:30 -0800 Subject: [PATCH] Check WP_REDIS_USE_RELAY is true too --- README.md | 1 + object-cache.php | 8 ++++++-- readme.txt | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ef75aa..17e38fb 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a ## Changelog ## ### 1.4.5-dev ### +* Support Relay in `check_client_dependencies()` correctly [[#471](https://github.com/pantheon-systems/wp-redis/pull/471)] (props @EarthlingDavey) ### 1.4.4 (November 27, 2023) ### * Updates Pantheon WP Coding Standards to 2.0 [[#445](https://github.com/pantheon-systems/wp-redis/pull/445)] diff --git a/object-cache.php b/object-cache.php index 7ac0757..72a1dc4 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1226,8 +1226,12 @@ protected function _connect_redis() { * not with a message describing the issue. */ public function check_client_dependencies() { - $has_relay = defined( 'WP_REDIS_USE_RELAY' ) && class_exists( 'Relay\Relay' ); - if ( ! $has_relay || ! class_exists( 'Redis' ) ) { + $class_to_check = 'Redis'; + if ( defined( 'WP_REDIS_USE_RELAY' ) && WP_REDIS_USE_RELAY ) { + $class_to_check = 'Relay\Relay'; + } + + if ( ! class_exists( $class_to_check ) ) { return 'Warning! PHPRedis extension is unavailable, which is required by WP Redis object cache.'; } return true; diff --git a/readme.txt b/readme.txt index e96e524..a1073a8 100644 --- a/readme.txt +++ b/readme.txt @@ -106,6 +106,7 @@ Please report security bugs found in the source code of the WP Redis plugin thro == Changelog == = 1.4.5-dev = +* Support Relay in check_client_dependencies() with the WP_REDIS_USE_RELAY constant [[#471](https://github.com/pantheon-systems/wp-redis/pull/471)] = 1.4.4 (November 27, 2023) = * Updates Pantheon WP Coding Standards to 2.0 [[#445](https://github.com/pantheon-systems/wp-redis/pull/445)]