Skip to content
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

Exit the script early if the class doesn't exist, or it's been manually disabled. #468

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

EarthlingDavey
Copy link
Contributor

A PR for your consideration:

There may be cases where the correct Redis class does not exist, this case will be handled gracefully.

Or there may be a case where the script needs to be disabled quickly without re-deployment, the ENV VAR WP_REDIS_DISABLED can be used for this case.

jazzsequence and others added 5 commits February 18, 2025 09:43
* re-add missing else

* use the already-defined value of $port instead of hard-coding

* remove ternary in favor of elseif
…er issues (pantheon-systems#434)

* fix: Fixes incorrect order of array_replace_recursive arguments & other issues

* Fixes pantheon-systems#433
* Fixes pantheon-systems#432
* Fixes pantheon-systems#431
* Further clean-up & standardization between object-cache.php & wp-redis.php.
* Fixes incorrect order of array_replace_recursive arguments.
* Addresses issue with port still not being null for socket connections due to defaults array_repalce_recursive use.

* fix: Fixes sanitization methods and linting issues

* Adjusts some items to use type-based sanitization.
* Adds linting expection handling with comments for cases that require it.

* fix: Removes invalid change made in pantheon-systems#437

* Reverts this incorrect change that was made due to the incorrect use of `array_replace_recursive()`.

* update  changelog

* Update wp-redis.php

* update language in changelogs

* fix missing closing )

---------

Co-authored-by: Chris Reynolds <[email protected]>
Co-authored-by: Phil Tyler <[email protected]>
* Bump behat/behat from 3.13.0 to 3.14.0

Bumps [behat/behat](https://github.com/Behat/Behat) from 3.13.0 to 3.14.0.
- [Release notes](https://github.com/Behat/Behat/releases)
- [Changelog](https://github.com/Behat/Behat/blob/master/CHANGELOG.md)
- [Commits](Behat/Behat@v3.13.0...v3.14.0)

---
updated-dependencies:
- dependency-name: behat/behat
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Upgrade yoast/phpunit-polyfills to 1.1.0

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Phil Tyler <[email protected]>
@jazzsequence jazzsequence requested a review from pwtyler February 18, 2025 17:05
@jazzsequence
Copy link
Contributor

Cleaned up the PR & merge conflicts
@pwtyler would like your eyes on this to make sure it looks good to you. I think it's probably better to merge this sooner than later so it doesn't fall behind again.

}

// Conditionally run the script if: the correct class exists, and the script has not been disabled.
if ( ! class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) && ( defined( 'WP_REDIS_DISABLED' ) && WP_REDIS_DISABLED ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have an || in the middle?

if ( ! class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) || ( defined( 'WP_REDIS_DISABLED' ) && WP_REDIS_DISABLED ) ) {

In other words, if the class doesn't exist or WP Redis is disabled, then return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants