Make WordPress Core

Changeset 65874


Ignore:
Timestamp:
12/03/2026 03:36:38 AM (17 hours ago)
Author:
adamsilverstein
Message:

Build/Test Tools: Support WP-CLI 3.0 in the plugin compatibility checks.

Address a change in WP-CLI 3.0 which changed its default context from cli to auto, which loads the admin for plugin commands. This broke certain testing flows and is now fixed by specifying the cli context.

Follow-up to [65872], [65873].
See #65920.

Location:
trunk/tools/plugin-compatibility
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/plugin-compatibility/fixtures/expected.txt

    r65872 r65874  
    2525fixture-requires-broken-dependency SKIPPED  The required plugins are not healthy on their own
    2626fixture-requires-wp-cli-only-fatal SKIPPED  WP-CLI cannot load WordPress with the required plugins active
     27fixture-redirects-in-admin         PASS
     28fixture-requires-redirects-in-admin PASS    fixture-redirects-in-admin
    2729
    2830# These two must stay together and in this order: the second fatals if anything the first wrote survived the
  • trunk/tools/plugin-compatibility/test-plugins.sh

    r65873 r65874  
    433433# launcher, such as the `bin/wp` of a Composer install, is run as it is and passed the limit through the
    434434# `WP_CLI_PHP_ARGS` it reads. Handing a shell script to PHP would print it rather than run it.
     435#
     436# `--context=cli` keeps WP-CLI 3.0 and later from loading the admin for plugin commands, as 2.x did. In the
     437# admin, a redirect on `admin_init`, such as the one WooCommerce makes after activation, ends the command
     438# early with exit code 0.
    435439wp() {
    436440        if [ "${WP_CLI_IS_LAUNCHER}" = "yes" ]; then
    437                 WP_CLI_PHP_ARGS="-d memory_limit=-1${WP_CLI_PHP_ARGS:+ ${WP_CLI_PHP_ARGS}}" "${WP_CLI_BIN}" "$@"
     441                WP_CLI_PHP_ARGS="-d memory_limit=-1${WP_CLI_PHP_ARGS:+ ${WP_CLI_PHP_ARGS}}" "${WP_CLI_BIN}" --context=cli "$@"
    438442        else
    439                 php -d memory_limit=-1 "${WP_CLI_BIN}" "$@"
     443                php -d memory_limit=-1 "${WP_CLI_BIN}" --context=cli "$@"
    440444        fi
    441445}
Note: See TracChangeset for help on using the changeset viewer.