-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SITE-2632] Update check_client_dependencies to check for Relay #471
Conversation
This PR fixes 2 cases where `WP_REDIS_USE_RELAY=true` - The class is not checked for existence. - The drop-in will not run if Redis extension is not installed. The fix: - Relay\Relay is correctly checked for existence. - The drop-in still works if the Redis extension is not installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if WP_REDIS_USE_RELAY
constant does not exist, PHP errors are thrown. More logic needed to handle if that constant exists before using it in the condition.
object-cache.php
Outdated
@@ -1226,7 +1226,7 @@ protected function _connect_redis() { | |||
* not with a message describing the issue. | |||
*/ | |||
public function check_client_dependencies() { | |||
if ( ! class_exists( 'Redis' ) ) { | |||
if ( ! class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( ! class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) ) { | |
$has_relay = defined( 'WP_REDIS_USE_RELAY' ) && class_exists( 'Relay\Relay' ); | |
if ( ! $has_relay || ! class_exists( 'Redis' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah,I applied this change, but in fact we need to check defined('WP_REDIS_USE_RELAY') && WP_REDIS_USE_RELAY && class_exists( 'Relay\Relay' ), in the event the constant is set and false.
@pwtyler My suggested change should handle the condition that's failing the unit tests. Once merged, I think this is probably g2g. Needs changelog update and version bump if we're pushing a release. |
Hi @jazzsequence , thanks for catching this and for the suggestion. I can pick it up next week. |
Co-authored-by: Chris Reynolds <[email protected]>
Hey folks, apologies for not thoroughly testing my first PR. Having read all feedback, would the following be ok?
|
@EarthlingDavey at a glance, that looks like it would work. @pwtyler do you agree? |
This PR fixes 2 cases where
WP_REDIS_USE_RELAY=true
The fix: