diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 5d5df5e1..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,64 +0,0 @@ -version: 2.1 -workflows: - main: - jobs: - - test-behat - nightly: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - release - jobs: - - test-behat - -jobs: - test-behat: - resource_class: small - working_directory: ~/pantheon-systems/wp-redis - parallelism: 1 - docker: - - image: quay.io/pantheon-public/build-tools-ci:8.x-php8.2 - steps: - - checkout - - restore_cache: - keys: - - test-behat-dependencies-{{ checksum "composer.json" }} - - run: composer install -n --prefer-dist - - save_cache: - key: test-behat-dependencies-{{ checksum "composer.json" }} - paths: - - vendor - - run: echo $(openssl rand -hex 8) > /tmp/WORDPRESS_ADMIN_PASSWORD - - run: | - echo 'export TERMINUS_ENV=ci-$CIRCLE_BUILD_NUM' >> $BASH_ENV - echo 'export TERMINUS_SITE=wp-redis' >> $BASH_ENV - echo 'export SITE_ENV=wp-redis.ci-$CIRCLE_BUILD_NUM' >> $BASH_ENV - echo 'export WORDPRESS_ADMIN_USERNAME=pantheon' >> $BASH_ENV - echo 'export WORDPRESS_ADMIN_EMAIL=no-reply@getpantheon.com' >> $BASH_ENV - echo 'export WORDPRESS_ADMIN_PASSWORD=$(cat /tmp/WORDPRESS_ADMIN_PASSWORD)' >> $BASH_ENV - source $BASH_ENV - - run: echo "StrictHostKeyChecking no" >> "$HOME/.ssh/config" - - run: | - if [ -z "$GITHUB_TOKEN" ]; then - echo "GITHUB_TOKEN environment variables missing; assuming unauthenticated build" - exit 0 - fi - echo "Setting GitHub OAuth token with suppressed output" - { - composer config -g github-oauth.github.com $GITHUB_TOKEN - } &> /dev/null - - run: | - if [ -z "$TERMINUS_TOKEN" ]; then - echo "TERMINUS_TOKEN environment variables missing; assuming unauthenticated build" - exit 0 - fi - terminus auth:login --machine-token=$TERMINUS_TOKEN - - run: ./bin/validate-fixture-version.sh - - run: ./bin/behat-prepare.sh - - run: ./bin/behat-test.sh --strict - - run: - command: ./bin/behat-cleanup.sh - when: always diff --git a/.distignore b/.distignore new file mode 100644 index 00000000..665d36e9 --- /dev/null +++ b/.distignore @@ -0,0 +1,43 @@ +# A set of files you probably don't want in your WordPress.org distribution +.babelrc +.deployignore +.distignore +.editorconfig +.eslintignore +.eslintrc +.git +.gitattributes +.github +.gitignore +.gitlab-ci.yml +.travis.yml +.DS_Store +Thumbs.db +behat.yml +bin +.circleci +circle.yml +composer.json +composer.lock +Gruntfile.js +package.json +package-lock.json +phpunit.xml +phpunit.xml.dist +multisite.xml +multisite.xml.dist +.phpcs.xml +.phpcs.xml.dist +phpcs.xml +phpcs.xml.dist +README.md +wp-cli.local.yml +yarn.lock +tests +vendor +node_modules +*.sql +*.tar.gz +*.zip +.wordpress-org +bootstrap.php diff --git a/.github/workflows/build-tag-release.yml b/.github/workflows/build-tag-release.yml index fc2e69d4..1967680a 100644 --- a/.github/workflows/build-tag-release.yml +++ b/.github/workflows/build-tag-release.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Build, tag, and release - uses: pantheon-systems/plugin-release-actions/build-tag-release@v0 + uses: pantheon-systems/plugin-release-actions/build-tag-release@a3839d25efa9d0d4270c088702c2072a2e49edde # v0.5.0 with: gh_token: ${{ secrets.GITHUB_TOKEN }} generate_release_notes: "true" diff --git a/.github/workflows/composer-diff.yml b/.github/workflows/composer-diff.yml index 35e28dd1..f2989d3c 100644 --- a/.github/workflows/composer-diff.yml +++ b/.github/workflows/composer-diff.yml @@ -12,13 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: 0 - name: Generate composer diff id: composer_diff - uses: IonBazan/composer-diff-action@v1 - - uses: marocchino/sticky-pull-request-comment@v2 + uses: IonBazan/composer-diff-action@3140157575f6a67799cc80248ae35f5fb303ab15 # v1.2.0 + - uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 if: ${{ steps.composer_diff.outputs.composer_diff_exit_code != 0 }} with: header: composer-diff diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index f97f30f7..7097852a 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -7,45 +7,35 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 - - uses: pantheon-systems/validate-readme-spacing@v1 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: pantheon-systems/validate-readme-spacing@229ea162621009cf8e09bf2beba405017150130e # v1.0.5 lint: name: PHPCS Linting runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 with: path: ~/vendor key: test-lint-dependencies-{{ checksum "composer.json" }} restore-keys: test-lint-dependencies-{{ checksum "composer.json" }} - name: Setup PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2 with: php-version: 8.3 - name: Install dependencies run: composer install -n --prefer-dist - name: Run PHP Lint run: composer phpcs - wporg-validation: - name: WP.org Validator - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: WP.org Validator - uses: pantheon-systems/action-wporg-validator@v1.1.5 - with: - type: plugin php8-compatibility: name: PHP 8.x Compatibility runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 - - uses: pantheon-systems/phpcompatibility-action@dev + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: pantheon-systems/phpcompatibility-action@bd72eb001d4fb9817c9d6e1a157a71e287f3ff80 # dev 2023-10-04T16:54:18Z with: paths: ${{ github.workspace }}/*.php test-versions: 8.0- @@ -55,7 +45,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php_version: [7.4, 8.2, 8.3, 8.4] + php_version: [7.4, 8.2, 8.3, 8.4, 8.5] redis_enabled: [true, false] services: mariadb: @@ -65,9 +55,9 @@ jobs: ports: - 6379:6379 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Setup PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2 with: php-version: ${{ matrix.php_version }} extensions: mysqli, zip, imagick, redis @@ -78,16 +68,18 @@ jobs: sudo apt-get install -y redis-tools redis-cli -h localhost ping - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 with: path: ~/vendor key: test-dependencies-{{ checksum "composer.json" }} restore-keys: test-dependencies-{{ checksum "composer.json" }} - name: Setup WP-CLI - uses: godaddy-wordpress/setup-wp-cli@1 + uses: godaddy-wordpress/setup-wp-cli@80c9a89bd347082429795c0f12acf567e2c390d4 # 1 2022-10-04T19:52:20Z - name: Install dependencies run: | if [ ${{ matrix.php_version }} = "7.4" ]; then + echo "🔄 Installing Pantheon WP Coding Standards v2.0 for PHP 7.4" + composer require pantheon-systems/pantheon-wp-coding-standards:^2.0 --dev --no-update composer update fi composer install diff --git a/.github/workflows/plugin-version.yml b/.github/workflows/plugin-version.yml index 9758d765..857a1e27 100644 --- a/.github/workflows/plugin-version.yml +++ b/.github/workflows/plugin-version.yml @@ -12,8 +12,8 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: fetch-depth: 0 - name: Validate Plugin Version - uses: jazzsequence/action-validate-plugin-version@v1.2.6 \ No newline at end of file + uses: jazzsequence/action-validate-plugin-version@6b8b403af6e9eefde9c36c0d342b717d5952b518 # v2.0.1 \ No newline at end of file diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 00000000..313cc11f --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -0,0 +1,21 @@ +name: Draft Release PR +on: + push: + branches: + - main + +permissions: + pull-requests: write + contents: write + +jobs: + draft-release: + name: Draft Release PR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - name: Create Draft Release PR + uses: pantheon-systems/plugin-release-actions/release-pr@a3839d25efa9d0d4270c088702c2072a2e49edde # main 2025-11-07T23:23:14Z + with: + gh_token: ${{ github.token }} + readme_md: README.md diff --git a/.github/workflows/test-behat.yml b/.github/workflows/test-behat.yml new file mode 100644 index 00000000..182ab21f --- /dev/null +++ b/.github/workflows/test-behat.yml @@ -0,0 +1,88 @@ +# Name of the GitHub Actions workflow. +name: Test-Behat + +# Controls when the action will run. +on: + pull_request: + workflow_dispatch: + schedule: + # Runs nightly at 00:00 UTC. + - cron: "0 0 * * *" + +permissions: + contents: read + actions: write + +# Defines the jobs to run in the workflow. +jobs: + test-behat: + # Use the latest Ubuntu runner. + runs-on: ubuntu-latest + + steps: + # Checks out your repository under $GITHUB_WORKSPACE, so your job can access it. + - name: Checkout code + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + fetch-depth: 0 + + # Caches the vendor directory to speed up subsequent builds. + # The cache is invalidated when composer.json changes. + - name: Cache dependencies + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 + with: + path: vendor + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install Terminus + uses: pantheon-systems/terminus-github-actions@8e024bd89ff46ed2aa4e0663c6b54c87a94344f8 # v1.2.7 + with: + pantheon-machine-token: ${{ secrets.TERMINUS_TOKEN }} + + # Sets up environment variables that will be available to subsequent steps in the job. + # Truncates the environment name to 11 characters to comply with Pantheon's limit. + - name: Set up environment variables + run: | + ENV_NAME="ci-$(echo ${{ github.run_id }} | cut -c1-8)" + echo "WORDPRESS_ADMIN_PASSWORD=$(openssl rand -hex 8)" >> $GITHUB_ENV + echo "TERMINUS_ENV=${ENV_NAME}" >> $GITHUB_ENV + echo "TERMINUS_SITE=${{ vars.TERMINUS_SITE }}" >> $GITHUB_ENV + echo "SITE_ENV=${{ vars.TERMINUS_SITE }}.${ENV_NAME}" >> $GITHUB_ENV + echo "WORDPRESS_ADMIN_USERNAME=pantheon" >> $GITHUB_ENV + echo "WORDPRESS_ADMIN_EMAIL=no-reply@getpantheon.com" >> $GITHUB_ENV + + # Configures SSH to automatically accept new host keys. + - name: Force SSH to ignore host keys + run: echo "GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" >> $GITHUB_ENV + + - name: Install SSH key + uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + # Configures Composer with the GitHub token for accessing private repositories. + # The GITHUB_TOKEN is automatically provided by GitHub Actions. + - name: Configure GitHub Token for Composer + run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + + - name: Validate fixture version + uses: jazzsequence/action-validate-plugin-version@6b8b403af6e9eefde9c36c0d342b717d5952b518 # v2.0.1 + with: + branch: ${{ github.head_ref }} + dry-run: 'true' + + # Prepares the environment for Behat tests. + - name: Prepare Behat tests + run: ./bin/behat-prepare.sh + + # Runs the Behat test suite. + - name: Run Behat tests + run: ./bin/behat-test.sh --strict + + # This cleanup step runs regardless of whether the preceding steps succeeded or failed. + - name: Cleanup after tests + if: always() + run: ./bin/behat-cleanup.sh + diff --git a/.github/workflows/wordpress-plugin-deploy.yml b/.github/workflows/wordpress-plugin-deploy.yml index 02f70797..8cc4ab25 100644 --- a/.github/workflows/wordpress-plugin-deploy.yml +++ b/.github/workflows/wordpress-plugin-deploy.yml @@ -7,9 +7,9 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: WordPress Plugin Deploy - uses: 10up/action-wordpress-plugin-deploy@2.3.0 + uses: 10up/action-wordpress-plugin-deploy@54bd289b8525fd23a5c365ec369185f2966529c2 # 2.3.0 2025-01-21T15:30:29Z env: SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} diff --git a/.github/workflows/wporg-validator.yml b/.github/workflows/wporg-validator.yml index 90624d89..4bf6f896 100644 --- a/.github/workflows/wporg-validator.yml +++ b/.github/workflows/wporg-validator.yml @@ -1,13 +1,50 @@ -# On push, run the action-wporg-validator workflow. name: WP.org Validator -on: [push] +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + jobs: - wporg-validation: + validate: + name: Validate Plugin runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: WP.org Validator - uses: pantheon-systems/action-wporg-validator@v1.1.5 - with: - type: plugin + - name: Checkout + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd + - name: Setup PHP 8.4 + uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 + with: + php-version: "8.4" + extensions: mysqli + tools: composer,wp-cli + + - name: Cache Composer dependencies + uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 + with: + path: | + ~/.composer/cache + vendor + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-dev --no-interaction --no-progress --prefer-dist --no-scripts --no-ansi + + - name: Create Dist Archive for wp.org validation + env: + COMPOSER_AUTH: '{"github-oauth": {}}' + run: | + rm -f ~/.composer/auth.json + wp package install wp-cli/dist-archive-command:v3.1.0 + wp dist-archive . --plugin-dirname=wp-redis --filename-format=wp-redis-dist + unzip ../wp-redis-dist.zip + + - name: Run plugin check + uses: wordpress/plugin-check-action@6f5a57e173c065a394b78688f75df543e4011902 + with: + build-dir: wp-redis \ No newline at end of file diff --git a/.gitignore b/.gitignore index 45801a04..1c393fd3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.zip +.codacy +.idea .DS_Store node_modules/ vendor/ @@ -8,4 +10,4 @@ tests/pantheon-wordpress-upstream bin/install-local-tests.sh bin/install-wp-tests.sh bin/phpunit-test.sh -bin/helpers.sh \ No newline at end of file +bin/helpers.sh diff --git a/.wordpress-org/banner-1544x500.png b/.wordpress-org/banner-1544x500.png index 0126ef02..f4fa9e02 100644 Binary files a/.wordpress-org/banner-1544x500.png and b/.wordpress-org/banner-1544x500.png differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png index 186d2ca0..cd1a945d 100644 Binary files a/.wordpress-org/banner-772x250.png and b/.wordpress-org/banner-772x250.png differ diff --git a/.wordpress-org/icon-128x128.png b/.wordpress-org/icon-128x128.png index 0b082cac..2e0c16e4 100644 Binary files a/.wordpress-org/icon-128x128.png and b/.wordpress-org/icon-128x128.png differ diff --git a/.wordpress-org/icon-256x256.png b/.wordpress-org/icon-256x256.png index 715a3af2..cf68141d 100644 Binary files a/.wordpress-org/icon-256x256.png and b/.wordpress-org/icon-256x256.png differ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfa0eb47..0b4e0288 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,26 +31,37 @@ The behat tests require a Pantheon site with Redis enabled. Once you've created ## Release Process -1. From `main`, checkout a new branch `release_X.Y.Z`. -1. Make a release commit: - * In `README.md`, `readme.txt`, and `wp-redis.php`, remove the `-dev` from the version number. For the README files. the version number must be updated both at the top of the document as well as the changelog. - * Add the date to the `** X.Y.X **` heading in the changelogs in README.md, readme.txt, and any other appropriate location. +1. Merge your feature branch into `main` with a PR. This PR should include any necessary updates to the changelog in readme.txt and README.md. Features should be squash merged. +1. From main, checkout a new branch `release_X.Y.Z`. +1. Make a release commit: + * In `package.json`, `README.md`, `readme.txt`, and `wp-redis.php`, remove the `-dev` from the version number. + * For the README files, the version number must be updated both at the top of the document as well as the changelog. + * Add the date to the `** X.Y.Z **` heading in the changelogs in `README.md`, `readme.txt`, and any other appropriate location. * Commit these changes with the message `Release X.Y.Z` * Push the release branch up. 1. Open a Pull Request to merge `release_X.Y.Z` into `release`. Your PR should consist of all commits to `main` since the last release, and one commit to update the version number. The PR name should also be `Release X.Y.Z`. -1. After all tests pass and you have received approval from a [CODEOWNER](./CODEOWNERS), merge the PR into `release`. A merge commit is preferred in this case. _Never_ squash to `release`. -1. CI will then tag and draft a [new release](https://github.com/pantheon-systems/wp-redis/releases) -1. Confirm that the necessary assets are present in the newly created tag, and test on a WP install if desired. -1. Open the release draft, review the changelog, and publish the release when ready. -1. Wait for the [_Release wp-redis plugin to wp.org_ action](https://github.com/pantheon-systems/wp-redis/actions/workflows/wordpress-plugin-deploy.yml) to finish deploying to the WordPress.org plugin repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes. -1. Check WordPress.org: Ensure that the changes are live on [the plugin repository](https://wordpress.org/plugins/wp-redis/). This may take a few minutes. +1. After all tests pass and you have received approval from a CODEOWNER (including resolving any merge conflicts), merge the PR into `release`. Use a "merge" commit, do no not rebase or squash. If the GitHub UI doesn't offer a "Merge commit" option (only showing "Squash and merge" or "Rebase and merge"), merge from the terminal instead: + `git checkout release` + `git merge release_X.Y.Z` + `git push origin release` +1. After merging to the `release` branch, a draft Release will be automatically created by the build-tag-release workflow. This draft release will be automatically pre-filled with release notes. +1. Confirm that the necessary assets are present in the newly created tag, and test on a WP install if desired. +1. Review the release notes, making any necessary changes, and publish the release. +1. Wait for the release to wp.org action to finish deploying to the WordPress.org plugin repository. +1. If all goes well, users with SVN commit access for that plugin will receive an email with a diff of the changes. +1. Check WordPress.org: Ensure that the changes are live on the plugin repository. This may take a few minutes. 1. Following the release, prepare the next dev version with the following steps: * `git checkout release` * `git pull origin release` * `git checkout main` * `git rebase release` - * Update the version number in all locations, incrementing the version by one patch version, and add the `-dev` flag (e.g. after releasing `1.2.3`, the new version will be `1.2.4-dev`) - * Add a new `** X.Y.X-dev **` heading to the changelog + * Update the version number in all locations, incrementing the version by one patch version, and add the `-dev` flag (e.g. after releasing `1.2.3`, the new verison will be `1.2.4-dev`) + * Add a new `** X.Y.Z-dev **` heading to the changelog * `git add -A .` - * `git commit -m "Prepare X.Y.X-dev"` - * `git push origin main` + * `git commit -m "Prepare X.Y.Z-dev"` + * `git checkout -b release-XYZ-dev` + * `git push origin release-XYZ-dev` + * Create a pull request on GitHub UI from `release-XYZ-dev` to `main` to trigger all required status checks + * _Wait for all required status checks to pass in CI. Once all tests pass, push to main from the terminal:_ + * `git checkout main && git push origin main` + * _Note: While main is typically protected, having an open PR with passing tests allows direct push to main, which is the preferred method here._ diff --git a/README.md b/README.md index a3eaff63..49b2dfb2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # WP Redis # [![Actively Maintained](https://img.shields.io/badge/Pantheon-Actively_Maintained-yellow?logo=pantheon&color=FFDC28)](https://pantheon.io/docs/oss-support-levels#actively-maintained) -**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [mboynes](https://profiles.wordpress.org/mboynes), [Outlandish Josh](https://profiles.wordpress.org/outlandish-josh) [jspellman](https://profiles.wordpress.org/jspellman/) [jazzs3quence](https://profiles.wordpress.org/jazzs3quence/) -**Tags:** cache, plugin, redis +**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [mboynes](https://profiles.wordpress.org/mboynes), [Outlandish Josh](https://profiles.wordpress.org/outlandish-josh) [jspellman](https://profiles.wordpress.org/jspellman/) [jazzs3quence](https://profiles.wordpress.org/jazzs3quence/), [anaispantheor](https://profiles.wordpress.org/anaispantheor/), [metasim](https://profiles.wordpress.org/metasim/) +**Tags:** cache, object-cache, redis **Requires at least:** 3.0.1 -**Tested up to:** 6.8.1 +**Tested up to:** 6.9 **Requires PHP:** 7.4 -**Stable tag:** 1.4.6 +**Stable tag:** 1.4.8 **License:** GPLv2 or later -**License URI:** http://www.gnu.org/licenses/gpl-2.0.html +**License URI:** http://www.gnu.org/licenses/gpl-2.0.html Back your WP Object Cache with Redis, a high-performance in-memory storage backend. @@ -109,6 +109,12 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a ## Changelog ## +### 1.4.8 (31 July 2026) ### +* PHP 8.5 compatibility [[#551](https://github.com/pantheon-systems/wp-redis/pull/551)] + +### 1.4.7 (December 2, 2025) ### +* WordPress 6.9 compatibility [[#524](https://github.com/pantheon-systems/wp-redis/pull/524)] + ### 1.4.6 (June 17, 2025) ### * PHP 8.4 compatibility diff --git a/bin/behat-prepare.sh b/bin/behat-prepare.sh index a9732f2b..0e087675 100755 --- a/bin/behat-prepare.sh +++ b/bin/behat-prepare.sh @@ -24,6 +24,12 @@ fi set -ex +### +# Install Composer dependencies, including Behat. This makes the +# ./vendor/bin/behat executable available for the test runner. +### +composer install --no-progress --prefer-dist + ### # Create a new environment for this particular test run. ### @@ -75,7 +81,7 @@ git commit -m "Include WP Redis and its configuration files" git push # Sometimes Pantheon takes a little time to refresh the filesystem -terminus build:workflow:wait $TERMINUS_SITE.$TERMINUS_ENV +terminus workflow:wait "${TERMINUS_SITE}.${TERMINUS_ENV}" ### # Set up WordPress, theme, and plugins for the test run diff --git a/bin/validate-fixture-version.sh b/bin/validate-fixture-version.sh deleted file mode 100755 index 5a27b998..00000000 --- a/bin/validate-fixture-version.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -euo pipefail -IFS=$'\n\t' - -main(){ - export TERMINUS_HIDE_GIT_MODE_WARNING=1 - local DIRNAME=$(dirname "$0") - - if [ -z "${TERMINUS_SITE}" ]; then - echo "TERMINUS_SITE environment variable must be set" - exit 1 - fi - - if ! terminus whoami > /dev/null; then - if [ -z "${TERMINUS_TOKEN}" ]; then - echo "TERMINUS_TOKEN environment variable must be set or terminus already logged in." - exit 1 - fi - terminus auth:login --machine-token="${TERMINUS_TOKEN}" - fi - # Use find to locate the file with a case-insensitive search - README_FILE_PATH=$(find ${DIRNAME}/.. -iname "readme.txt" -print -quit) - if [[ -z "$README_FILE_PATH" ]]; then - echo "readme.txt not found." - exit 1 - fi - - local TESTED_UP_TO - TESTED_UP_TO=$(grep -i "Tested up to:" "${README_FILE_PATH}" | tr -d '\r\n' | awk -F ': ' '{ print $2 }') - echo "Tested Up To: ${TESTED_UP_TO}" - local FIXTURE_VERSION - FIXTURE_VERSION=$(terminus wp "${TERMINUS_SITE}.dev" -- core version) - echo "Fixture Version: ${FIXTURE_VERSION}" - - if ! php -r "exit(version_compare('${TESTED_UP_TO}', '${FIXTURE_VERSION}'));"; then - echo "${FIXTURE_VERSION} is less than ${TESTED_UP_TO}" - echo "Please update ${TERMINUS_SITE} to at least WordPress ${TESTED_UP_TO}" - exit 1 - fi -} - -main diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 00000000..da14dc89 --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: wp-redis + description: WordPress Object Cache using Redis. + annotations: + github.com/project-slug: pantheon-systems/wp-redis +spec: + type: service + lifecycle: production + owner: site-experience diff --git a/cli.php b/cli.php index b55bfd8c..218a8976 100644 --- a/cli.php +++ b/cli.php @@ -3,6 +3,10 @@ * Various WP Redis CLI utility commands. */ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + /** * Main WP Redis CLI command class. */ @@ -18,10 +22,10 @@ public function cli() { // Attempt to automatically load Pantheon's Redis config from the env. if ( isset( $_SERVER['CACHE_HOST'] ) && isset( $_SERVER['CACHE_PORT'] ) && isset( $_SERVER['CACHE_PASSWORD'] ) && isset( $_SERVER['CACHE_DB'] ) ) { $redis_server = [ - 'host' => sanitize_text_field( $_SERVER['CACHE_HOST'] ), - 'port' => sanitize_text_field( $_SERVER['CACHE_PORT'] ), - 'auth' => sanitize_text_field( $_SERVER['CACHE_PASSWORD'] ), - 'database' => sanitize_text_field( $_SERVER['CACHE_DB'] ), + 'host' => sanitize_text_field( wp_unslash( $_SERVER['CACHE_HOST'] ) ), + 'port' => sanitize_text_field( wp_unslash( $_SERVER['CACHE_PORT'] ) ), + 'auth' => sanitize_text_field( wp_unslash( $_SERVER['CACHE_PASSWORD'] ) ), + 'database' => sanitize_text_field( wp_unslash( $_SERVER['CACHE_DB'] ) ), ]; } else { $redis_server = [ diff --git a/composer.json b/composer.json index 21035f45..cf556232 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "behat/behat": "^3.1", "behat/mink-extension": "^2.2", "behat/mink-goutte-driver": "^1.2", - "pantheon-systems/pantheon-wp-coding-standards": "^2.0", + "pantheon-systems/pantheon-wp-coding-standards": "^3.0", "pantheon-systems/pantheon-wordpress-upstream-tests": "dev-master", "phpunit/phpunit": "^9", "yoast/phpunit-polyfills": "^4.0", @@ -35,6 +35,32 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "pantheon-systems/wpunit-helpers": true + }, + "audit": { + "ignore": { + "PKSA-z3gr-8qht-p93v": "Dev-only: phpunit/phpunit (test runner). No prod exposure. SITE-5206.", + "PKSA-5r1g-c7b7-y1zg": "Dev-only: symfony/dom-crawler via behat test deps. No prod exposure. SITE-5206.", + "PKSA-dwsq-ppd2-mb1x": "Dev-only: symfony/polyfill-intl-idn via behat test deps. No prod exposure. SITE-5206.", + "PKSA-v5yj-8nmz-sk2q": "Dev-only: symfony/yaml via behat test deps. No prod exposure. SITE-5206.", + "PKSA-ft77-7h5f-p3r6": "Dev-only: symfony/yaml via behat test deps. No prod exposure. SITE-5206.", + "PKSA-b14r-zh1d-vdrc": "Dev-only: symfony/yaml via behat test deps. No prod exposure. SITE-5206.", + "PKSA-rkkf-636k-qjb3": "Dev-only: symfony/process via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-wws7-mr54-jsny": "Dev-only: symfony/process via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-fy2t-3c5f-827y": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-qxvb-2bpp-dnk6": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-bbs6-q5q9-f3t4": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-bcdd-5xc7-gwfb": "Dev-only: guzzlehttp/guzzle via behat test deps (fabpot/goutte pins ^6, no 6.x patch exists). No prod exposure. VUL-24493. SITE-5995; remove when goutte driver replaced.", + "PKSA-pwsk-hy21-4gby": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-93qv-9n9h-6k6p": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-k22t-f949-t9g6": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-yfw5-9gnj-n2c7": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-k1b4-kshy-xgbh": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-2z36-j4q9-rsfy": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-fvw5-9t6n-nwvr": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-6d8m-6kgw-18zr": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-stmn-hvzq-wph6": "Dev-only: guzzlehttp/guzzle via behat mink-goutte-driver (fabpot/goutte) chain. No prod exposure. SITE-5995; remove when goutte driver replaced.", + "PKSA-vznr-tgp9-fd7d": "Dev-only: guzzlehttp/psr7 via behat test deps (guzzle 6 pins psr7 ^1.9, no 1.x patch exists). No prod exposure. VUL-25208." + } } }, "autoload": { diff --git a/composer.lock b/composer.lock index 564f1c8e..0ed89f3e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1ec03a587fe10d4013cb9dcc3665d2ef", + "content-hash": "1316db1fa72f8e7d96c5a9580146082b", "packages": [], "packages-dev": [ { @@ -510,28 +510,28 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v1.0.0", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/composer-installer.git", - "reference": "4be43904336affa5c2f70744a348312336afd0da" + "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", - "reference": "4be43904336affa5c2f70744a348312336afd0da", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", + "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", + "composer-plugin-api": "^2.2", "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { - "composer/composer": "*", + "composer/composer": "^2.2", "ext-json": "*", "ext-zip": "*", - "php-parallel-lint/php-parallel-lint": "^1.3.1", + "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpcompatibility/php-compatibility": "^9.0", "yoast/phpunit-polyfills": "^1.0" }, @@ -551,9 +551,9 @@ "authors": [ { "name": "Franck Nijhof", - "email": "franck.nijhof@dealerdirect.com", - "homepage": "http://www.frenck.nl", - "role": "Developer / IT Manager" + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" }, { "name": "Contributors", @@ -561,7 +561,6 @@ } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://www.dealerdirect.com", "keywords": [ "PHPCodeSniffer", "PHP_CodeSniffer", @@ -582,9 +581,28 @@ ], "support": { "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2023-01-05T11:28:13+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-07-17T20:45:56+00:00" }, { "name": "doctrine/instantiator", @@ -718,26 +736,27 @@ }, { "name": "fig-r/psr2r-sniffer", - "version": "1.5.1", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/php-fig-rectified/psr2r-sniffer.git", - "reference": "c950b88ed7ad8ae115e11896bbe36d5896aa4f36" + "reference": "0a4531090fb87ba95eafd21d482bb85ea878a08f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig-rectified/psr2r-sniffer/zipball/c950b88ed7ad8ae115e11896bbe36d5896aa4f36", - "reference": "c950b88ed7ad8ae115e11896bbe36d5896aa4f36", + "url": "https://api.github.com/repos/php-fig-rectified/psr2r-sniffer/zipball/0a4531090fb87ba95eafd21d482bb85ea878a08f", + "reference": "0a4531090fb87ba95eafd21d482bb85ea878a08f", "shasum": "" }, "require": { - "php": ">=7.3", - "slevomat/coding-standard": "^7.2.0 || ^8.3.0", - "spryker/code-sniffer": "^0.17.1", + "php": ">=8.1", + "php-collective/code-sniffer": "^0.2.14", + "slevomat/coding-standard": "^8.16.0", "squizlabs/php_codesniffer": "^3.7.0" }, "require-dev": { - "phpstan/phpstan": "^1.0.0" + "phpstan/phpstan": "^2.1.0", + "phpunit/phpunit": "^10.3 || ^11.5 || 12.0" }, "bin": [ "bin/tokenize", @@ -768,9 +787,9 @@ ], "support": { "issues": "https://github.com/php-fig-rectified/psr2r-sniffer/issues", - "source": "https://github.com/php-fig-rectified/psr2r-sniffer/tree/1.5.1" + "source": "https://github.com/php-fig-rectified/psr2r-sniffer/tree/2.2.1" }, - "time": "2023-09-23T19:16:19+00:00" + "time": "2025-05-12T17:06:00+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1226,29 +1245,35 @@ }, { "name": "pantheon-systems/pantheon-wp-coding-standards", - "version": "2.0.3", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/pantheon-systems/Pantheon-WP-Coding-Standards.git", - "reference": "5008d7416057ab0420bcddd407d9833340a0081d" + "reference": "40a97fc4da4611f5f63f460211ff1e7d59b71f72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pantheon-systems/Pantheon-WP-Coding-Standards/zipball/5008d7416057ab0420bcddd407d9833340a0081d", - "reference": "5008d7416057ab0420bcddd407d9833340a0081d", + "url": "https://api.github.com/repos/pantheon-systems/Pantheon-WP-Coding-Standards/zipball/40a97fc4da4611f5f63f460211ff1e7d59b71f72", + "reference": "40a97fc4da4611f5f63f460211ff1e7d59b71f72", "shasum": "" }, "require": { "automattic/vipwpcs": "^3.0", - "fig-r/psr2r-sniffer": "^1.5", + "fig-r/psr2r-sniffer": "^2.2", "phpcompatibility/phpcompatibility-wp": "^2.1", "wp-coding-standards/wpcs": "^3.0" }, "require-dev": { - "phpunit/phpunit": "9.6.x-dev", - "yoast/phpunit-polyfills": "1.x-dev" + "squizlabs/php_codesniffer": "^3.13", + "yoast/phpunit-polyfills": "4.0.0" }, "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "Pantheon_WP\\": "Pantheon-WP/", + "Pantheon_WP_Minimum\\": "Pantheon-WP-Minimum/" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -1262,22 +1287,22 @@ "description": "PHPCS Rulesets for WordPress projects on Pantheon.", "support": { "issues": "https://github.com/pantheon-systems/Pantheon-WP-Coding-Standards/issues", - "source": "https://github.com/pantheon-systems/Pantheon-WP-Coding-Standards/tree/2.0.3" + "source": "https://github.com/pantheon-systems/Pantheon-WP-Coding-Standards/tree/3.0.1" }, - "time": "2024-07-05T21:39:52+00:00" + "time": "2025-07-21T20:47:08+00:00" }, { "name": "pantheon-systems/wpunit-helpers", - "version": "v2.0.2", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/pantheon-systems/wpunit-helpers.git", - "reference": "8e767a2d59abc16b4fc5bedc12e0adbb87554044" + "reference": "1f8c7bd39d83f23c3416d7ec46e6fb4ad917d8e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pantheon-systems/wpunit-helpers/zipball/8e767a2d59abc16b4fc5bedc12e0adbb87554044", - "reference": "8e767a2d59abc16b4fc5bedc12e0adbb87554044", + "url": "https://api.github.com/repos/pantheon-systems/wpunit-helpers/zipball/1f8c7bd39d83f23c3416d7ec46e6fb4ad917d8e0", + "reference": "1f8c7bd39d83f23c3416d7ec46e6fb4ad917d8e0", "shasum": "" }, "require": { @@ -1308,9 +1333,9 @@ "description": "Unified scripts for installing and running automated WP Unit Tests.", "support": { "issues": "https://github.com/pantheon-systems/wpunit-helpers/issues", - "source": "https://github.com/pantheon-systems/wpunit-helpers/tree/v2.0.2" + "source": "https://github.com/pantheon-systems/wpunit-helpers/tree/v2.0.3" }, - "time": "2025-01-06T18:07:41+00:00" + "time": "2025-08-07T16:28:07+00:00" }, { "name": "phar-io/manifest", @@ -1430,6 +1455,68 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "php-collective/code-sniffer", + "version": "0.2.18", + "source": { + "type": "git", + "url": "https://github.com/php-collective/code-sniffer.git", + "reference": "5c2816b039d93977eace82927cc5e3404c3aabf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-collective/code-sniffer/zipball/5c2816b039d93977eace82927cc5e3404c3aabf1", + "reference": "5c2816b039d93977eace82927cc5e3404c3aabf1", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "slevomat/coding-standard": "^8.16.0", + "squizlabs/php_codesniffer": "^3.11.3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0.0", + "phpunit/phpunit": "^10.3 || ^11.2 || ^12.0" + }, + "bin": [ + "bin/tokenize" + ], + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "PhpCollective\\": "PhpCollective/", + "PhpCollectiveStrict\\": "PhpCollectiveStrict/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "The PHP Collective", + "homepage": "https://github.com/php-collective" + }, + { + "name": "Spryker", + "homepage": "https://spryker.com" + } + ], + "description": "PhpCollective Code Sniffer Standards", + "homepage": "https://github.com/php-collective/code-sniffer", + "keywords": [ + "codesniffer", + "framework", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/php-collective/code-sniffer/issues", + "source": "https://github.com/php-collective/code-sniffer" + }, + "time": "2025-07-11T12:29:15+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -1566,21 +1653,22 @@ }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.5", + "version": "2.1.7", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" + "reference": "5bfbbfbabb3df2b9a83e601de9153e4a7111962c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", - "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/5bfbbfbabb3df2b9a83e601de9153e4a7111962c", + "reference": "5bfbbfbabb3df2b9a83e601de9153e4a7111962c", "shasum": "" }, "require": { "phpcompatibility/php-compatibility": "^9.0", - "phpcompatibility/phpcompatibility-paragonie": "^1.0" + "phpcompatibility/phpcompatibility-paragonie": "^1.0", + "squizlabs/php_codesniffer": "^3.3" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0" @@ -1630,35 +1718,39 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcompatibility", + "type": "thanks_dev" } ], - "time": "2024-04-24T21:37:59+00:00" + "time": "2025-05-12T16:38:37+00:00" }, { "name": "phpcsstandards/phpcsextra", - "version": "1.2.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", - "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/fa4b8d051e278072928e32d817456a7fdb57b6ca", + "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.0.9", - "squizlabs/php_codesniffer": "^3.8.0" + "phpcsstandards/phpcsutils": "^1.1.0", + "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", + "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpcsstandards/phpcsdevcs": "^1.1.6", "phpcsstandards/phpcsdevtools": "^1.2.1", - "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "type": "phpcodesniffer-standard", "extra": { @@ -1708,35 +1800,39 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2023-12-08T16:49:07+00:00" + "time": "2025-06-14T07:40:39+00:00" }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.12", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" + "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", - "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/65355670ac17c34cd235cf9d3ceae1b9252c4dad", + "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" }, "require-dev": { "ext-filter": "*", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", + "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpcsstandards/phpcsdevcs": "^1.1.6", - "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" }, "type": "phpcodesniffer-standard", "extra": { @@ -1773,6 +1869,7 @@ "phpcodesniffer-standard", "phpcs", "phpcs3", + "phpcs4", "standards", "static analysis", "tokens", @@ -1796,36 +1893,40 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-05-20T13:34:27+00:00" + "time": "2025-06-12T04:32:33+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.33.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b9e61a61e39e02dd90944e9115241c7f7e76bfd8", + "reference": "b9e61a61e39e02dd90944e9115241c7f7e76bfd8", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -1843,9 +1944,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.2.0" }, - "time": "2024-10-13T11:25:22+00:00" + "time": "2025-07-13T07:04:09+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3429,16 +3530,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.19", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1" + "reference": "4debf5383d9ade705e0a25121f16c3fecaf433a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", - "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/4debf5383d9ade705e0a25121f16c3fecaf433a7", + "reference": "4debf5383d9ade705e0a25121f16c3fecaf433a7", "shasum": "" }, "require": { @@ -3449,9 +3550,8 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0", "phpcsstandards/phpcsdevcs": "^1.1", "phpstan/phpstan": "^1.7", - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0", - "sirbrillig/phpcs-import-detection": "^1.1", - "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0@beta" + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", + "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0" }, "type": "phpcodesniffer-standard", "autoload": { @@ -3483,36 +3583,36 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2024-06-26T20:08:34+00:00" + "time": "2025-03-17T16:17:38+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.15.0", + "version": "8.19.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "7d1d957421618a3803b593ec31ace470177d7817" + "reference": "458d665acd49009efebd7e0cb385d71ae9ac3220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", - "reference": "7d1d957421618a3803b593ec31ace470177d7817", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/458d665acd49009efebd7e0cb385d71ae9ac3220", + "reference": "458d665acd49009efebd7e0cb385d71ae9ac3220", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", - "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.9.0" + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.1.0", + "squizlabs/php_codesniffer": "^3.13.0" }, "require-dev": { - "phing/phing": "2.17.4", - "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.60", - "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.16", - "phpstan/phpstan-strict-rules": "1.5.2", - "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" + "phing/phing": "3.0.1", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.1.17", + "phpstan/phpstan-deprecation-rules": "2.0.3", + "phpstan/phpstan-phpunit": "2.0.6", + "phpstan/phpstan-strict-rules": "2.0.4", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.21|12.1.3" }, "type": "phpcodesniffer-standard", "extra": { @@ -3536,7 +3636,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.19.1" }, "funding": [ { @@ -3548,78 +3648,20 @@ "type": "tidelift" } ], - "time": "2024-03-09T15:20:58+00:00" - }, - { - "name": "spryker/code-sniffer", - "version": "0.17.18", - "source": { - "type": "git", - "url": "https://github.com/spryker/code-sniffer.git", - "reference": "5fb8b573abc4a906d0d364a4a03abd38e565ba29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spryker/code-sniffer/zipball/5fb8b573abc4a906d0d364a4a03abd38e565ba29", - "reference": "5fb8b573abc4a906d0d364a4a03abd38e565ba29", - "shasum": "" - }, - "require": { - "php": ">=7.4", - "slevomat/coding-standard": "^7.2.0 || ^8.0.1", - "squizlabs/php_codesniffer": "^3.6.2" - }, - "require-dev": { - "phpstan/phpstan": "^1.0.0", - "phpunit/phpunit": "^9.5" - }, - "bin": [ - "bin/tokenize" - ], - "type": "phpcodesniffer-standard", - "autoload": { - "psr-4": { - "Spryker\\": "Spryker/", - "SprykerStrict\\": "SprykerStrict/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Spryker", - "homepage": "https://spryker.com" - } - ], - "description": "Spryker Code Sniffer Standards", - "homepage": "https://spryker.com", - "keywords": [ - "codesniffer", - "framework", - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/spryker/code-sniffer/issues", - "source": "https://github.com/spryker/code-sniffer" - }, - "time": "2023-01-03T16:08:22+00:00" + "time": "2025-06-09T17:53:57+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.1", + "version": "3.13.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" + "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", + "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", "shasum": "" }, "require": { @@ -3684,9 +3726,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-05-22T21:24:41+00:00" + "time": "2025-06-17T22:17:01+00:00" }, { "name": "symfony/browser-kit", @@ -5772,7 +5818,7 @@ }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/object-cache.php b/object-cache.php index 72a1dc42..fb837096 100644 --- a/object-cache.php +++ b/object-cache.php @@ -7,6 +7,10 @@ * can use this to guarantee uniqueness for the keys generated by this object cache. */ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + if ( ! defined( 'WP_CACHE_KEY_SALT' ) ) { define( 'WP_CACHE_KEY_SALT', '' ); } @@ -439,6 +443,20 @@ class WP_Object_Cache { */ public $last_triggered_error = ''; + /** + * The Redis client instance + * + * @var Redis|Relay\Relay + */ + public $redis; + + /** + * Message describing why Redis is unavailable + * + * @var string + */ + public $missing_redis_message = ''; + /** * Whether or not to use true cache groups, instead of flattening. * @@ -1256,13 +1274,15 @@ public function build_client_parameters( $redis_server ) { if ( isset( $_SERVER['CACHE_HOST'] ) ) { $redis_server = [ // Don't use WP methods to sanitize the host due to plugin loading issues with other caching methods. - // @phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - 'host' => strip_tags( $_SERVER['CACHE_HOST'] ), - 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? intval( $_SERVER['CACHE_PORT'] ) : $port, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'host' => ( function_exists( 'wp_strip_all_tags' ) ? wp_strip_all_tags( wp_unslash( $_SERVER['CACHE_HOST'] ) ) : ( function_exists( 'wp_unslash' ) ? wp_unslash( $_SERVER['CACHE_HOST'] ) : $_SERVER['CACHE_HOST'] ) ), + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? intval( function_exists( 'wp_unslash' ) ? wp_unslash( $_SERVER['CACHE_PORT'] ) : $_SERVER['CACHE_PORT'] ) : $port, // Don't attempt to sanitize passwords as this can break authentication. - // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'] : null, - 'database' => ! empty( $_SERVER['CACHE_DB'] ) ? intval( $_SERVER['CACHE_DB'] ) : $database, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? ( function_exists( 'wp_unslash' ) ? wp_unslash( $_SERVER['CACHE_PASSWORD'] ) : $_SERVER['CACHE_PASSWORD'] ) : null, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'database' => ! empty( $_SERVER['CACHE_DB'] ) ? intval( function_exists( 'wp_unslash' ) ? wp_unslash( $_SERVER['CACHE_DB'] ) : $_SERVER['CACHE_DB'] ) : $database, ]; } else { $redis_server = [ @@ -1276,7 +1296,7 @@ public function build_client_parameters( $redis_server ) { if ( file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. // port must be null or socket won't connect. unset( $redis_server['port'] ); - $port = null; + $port = -1; } $defaults = [ @@ -1335,8 +1355,10 @@ public function perform_client_connection( $redis, $client_parameters, $keys_met $redis->$method( $client_parameters[ $key ] ); } catch ( RedisException $e ) { - // PhpRedis throws an Exception when it fails a server call. - // To prevent WordPress from fataling, we catch the Exception. + /** + * PhpRedis throws an Exception when it fails a server call. + * To prevent WordPress from fataling, we catch the Exception. + */ throw new Exception( $e->getMessage(), $e->getCode(), $e ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped } } @@ -1371,8 +1393,10 @@ protected function _call_redis( $method ) { return $retval; } catch ( Exception $e ) { $retry_exception_messages = $this->retry_exception_messages(); - // PhpRedis throws an Exception when it fails a server call. - // To prevent WordPress from fataling, we catch the Exception. + /** + * PhpRedis throws an Exception when it fails a server call. + * To prevent WordPress from fataling, we catch the Exception. + */ if ( $this->exception_message_matches( $e->getMessage(), $retry_exception_messages ) ) { $this->_exception_handler( $e ); @@ -1398,7 +1422,8 @@ protected function _call_redis( $method ) { $col1 = 'option_name'; $col2 = 'option_value'; } - $wpdb->query( "INSERT IGNORE INTO {$table} ({$col1},{$col2}) VALUES ('wp_redis_do_redis_failback_flush',1)" ); + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `{$table}` (`{$col1}`,`{$col2}`) VALUES (%s,%d)", 'wp_redis_do_redis_failback_flush', 1 ) ); $this->do_redis_failback_flush = true; } @@ -1540,11 +1565,13 @@ public function __construct() { $col1 = 'option_name'; $col2 = 'option_value'; } - $this->do_redis_failback_flush = (bool) $wpdb->get_results( "SELECT {$col2} FROM {$table} WHERE {$col1}='wp_redis_do_redis_failback_flush'" ); + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $this->do_redis_failback_flush = (bool) $wpdb->get_results( $wpdb->prepare( "SELECT `{$col2}` FROM `{$table}` WHERE `{$col1}`=%s", 'wp_redis_do_redis_failback_flush' ) ); if ( $this->is_redis_connected && $this->do_redis_failback_flush ) { $ret = $this->_call_redis( 'flushdb' ); if ( $ret ) { - $wpdb->query( "DELETE FROM {$table} WHERE {$col1}='wp_redis_do_redis_failback_flush'" ); + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $wpdb->query( $wpdb->prepare( "DELETE FROM `{$table}` WHERE `{$col1}`=%s", 'wp_redis_do_redis_failback_flush' ) ); $this->do_redis_failback_flush = false; } } diff --git a/readme.txt b/readme.txt index 8e5cc2a6..9ac9c16d 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ === WP Redis === -Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh, jspellman, jazzs3quence -Tags: cache, plugin, redis -Requires at least: 3.0.1 -Tested up to: 6.8.1 +Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh, jspellman, jazzs3quence, anaispantheor, metasim +Tags: cache, object-cache, redis +Requires at least: 5.3 +Tested up to: 7.0 Requires PHP: 7.4 -Stable tag: 1.4.6 +Stable tag: 1.4.8 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -106,6 +106,12 @@ Please report security bugs found in the source code of the WP Redis plugin thro == Changelog == += 1.4.8 (31 July 2026) = +* PHP 8.5 compatibility [[#551](https://github.com/pantheon-systems/wp-redis/pull/551)] + += 1.4.7 (December 2, 2025) = +* WordPress 6.9 compatibility [[#524](https://github.com/pantheon-systems/wp-redis/pull/524)] + = 1.4.6 (June 17, 2025) = * PHP 8.4 compatibility diff --git a/wp-redis.php b/wp-redis.php index 2b53333e..4961aab3 100644 --- a/wp-redis.php +++ b/wp-redis.php @@ -3,11 +3,17 @@ * Plugin Name: WP Redis * Plugin URI: http://github.com/pantheon-systems/wp-redis/ * Description: WordPress Object Cache using Redis. Requires the PhpRedis extension (https://github.com/phpredis/phpredis). - * Version: 1.4.6 + * Version: 1.4.8 * Author: Pantheon, Josh Koenig, Matthew Boynes, Daniel Bachhuber, Alley Interactive * Author URI: https://pantheon.io/ + * License: GPLv2 or later + * License URI: http://www.gnu.org/licenses/gpl-2.0.html */ +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,13 +51,15 @@ function wp_redis_get_info() { if ( isset( $_SERVER['CACHE_HOST'] ) ) { $redis_server = [ // Don't use WP methods to sanitize the host due to plugin loading issues with other caching methods. - // @phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - 'host' => strip_tags( $_SERVER['CACHE_HOST'] ), - 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? intval( $_SERVER['CACHE_PORT'] ) : $port, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'host' => wp_strip_all_tags( wp_unslash( $_SERVER['CACHE_HOST'] ) ), + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? intval( wp_unslash( $_SERVER['CACHE_PORT'] ) ) : $port, // Don't attempt to sanitize passwords as this can break authentication. - // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'] : null, - 'database' => ! empty( $_SERVER['CACHE_DB'] ) ? intval( $_SERVER['CACHE_DB'] ) : $database, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? wp_unslash( $_SERVER['CACHE_PASSWORD'] ) : null, + // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated + 'database' => ! empty( $_SERVER['CACHE_DB'] ) ? intval( wp_unslash( $_SERVER['CACHE_DB'] ) ) : $database, ]; } else { $redis_server = [