Skip to content

Commit d0cffe1

Browse files
swissspidyclaude
andcommitted
Merge remote-tracking branch 'origin/main' into contrib-fix/extension-command-556
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
2 parents fc7b6c5 + eff3281 commit d0cffe1

31 files changed

Lines changed: 1186 additions & 121 deletions

‎.github/actionlint.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ paths:
1111
# catching genuine typos in permission names.
1212
# See https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli-in-actions
1313
- 'unknown permission scope "copilot-requests"'
14+
# Steps can run in parallel through the `background`, `wait`, `wait-all`,
15+
# `cancel` and `parallel` keywords, but actionlint does not know them yet:
16+
# it rejects `background` as an unexpected key, and a `wait-all` or
17+
# `parallel` step as one that has neither `run` nor `uses`. Drop these
18+
# entries once actionlint supports the keywords. Until then, a step that is
19+
# genuinely missing both `run` and `uses` is no longer reported.
20+
# See https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsparallel
21+
- 'unexpected key "background" for step'
22+
- 'step must run script with "run" section or run action with "uses" section'

‎.github/dependabot.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ updates:
99
- scope:distribution
1010
cooldown:
1111
default-days: 7
12+
# Packages from our own org are trusted, so they are updated immediately.
13+
exclude:
14+
- "wp-cli/*"
1215
# Only wp-cli-tests carries a package.json, holding the pinned version of the
1316
# Gherkin linter. This is a no-op in every other repository.
1417
- package-ecosystem: npm

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,44 @@ jobs:
3939
id: check_composer_file
4040
run: echo "files_exists=$(test -f composer.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
4141

42-
- name: Set up PHP environment
43-
if: steps.check_composer_file.outputs.files_exists == 'true'
44-
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
45-
with:
46-
php-version: 'latest'
47-
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
48-
coverage: 'none'
49-
tools: composer,cs2pr
50-
env:
51-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
53-
- name: Install Composer dependencies & cache dependencies
54-
if: steps.check_composer_file.outputs.files_exists == 'true'
55-
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
56-
env:
57-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
58-
5942
# Without a database the Behat runner silently falls back to SQLite, so the
6043
# agent's test runs are not the ones CI will do. Mirrors the setup in
6144
# reusable-functional.yml.
6245
- name: Check existence of behat.yml file
6346
id: check_behat_file
6447
run: echo "files_exists=$(test -f behat.yml && echo true || echo false)" >> "$GITHUB_OUTPUT"
6548

49+
# Not run in the background: Copilot code review builds its workflow from
50+
# these steps and failed validation while they used `background` and
51+
# `wait-all`. Also, the action unpacks its binaries with the system `tar`,
52+
# which fails to load libpcre2 while setup-php upgrades it with apt.
6653
- name: Setup MySQL Server
6754
if: steps.check_behat_file.outputs.files_exists == 'true'
68-
uses: shogo82148/actions-setup-mysql@083ec148d28e62f2b24b8f4541693dfe1d50488d # v1
55+
uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1
6956
with:
7057
mysql-version: '8.0' # Standard MySQL version for these tests
7158
auto-start: true
7259
root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }}
7360
user: ${{ env.WP_CLI_TEST_DBUSER }}
7461
password: ${{ env.WP_CLI_TEST_DBPASS }}
7562

63+
- name: Set up PHP environment
64+
if: steps.check_composer_file.outputs.files_exists == 'true'
65+
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
66+
with:
67+
php-version: 'latest'
68+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
69+
coverage: 'none'
70+
tools: composer,cs2pr
71+
env:
72+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Install Composer dependencies & cache dependencies
75+
if: steps.check_composer_file.outputs.files_exists == 'true'
76+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
77+
env:
78+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
79+
7680
- name: Remove system MySQL binary
7781
if: steps.check_behat_file.outputs.files_exists == 'true'
7882
run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Milestone Merged Pull Requests
3+
4+
'on':
5+
pull_request_target:
6+
types: [closed]
7+
branches:
8+
- main
9+
- master
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
milestone:
17+
uses: wp-cli/.github/.github/workflows/reusable-milestone-merged-prs.yml@main

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This package is part of WP-CLI, the official command line interface for WordPress. For a detailed explanation of the project structure and development workflow, please refer to the main @README.md file.
44

5+
If the repository contains an @AGENTS.local.md file, read it as well. It holds instructions specific to this repository and takes precedence over this file where the two disagree.
6+
57
## Best Practices for Code Contributions
68

79
When contributing to this package, please adhere to the following guidelines:

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"wp-cli/entity-command": "^1.3 || ^2 || ^3",
2626
"wp-cli/language-command": "^2.0 || ^3",
2727
"wp-cli/scaffold-command": "^1.2 || ^2 || ^3",
28-
"wp-cli/wp-cli-tests": "^5"
28+
"wp-cli/wp-cli-tests": "^5.4.0"
2929
},
3030
"config": {
3131
"process-timeout": 7200,

‎extension-command.php‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ static function () {
5656
);
5757
}
5858
);
59+
60+
// Update data stored while --skip-plugins or --skip-themes is in effect must not
61+
// outlive the process, as it lacks what the skipped plugins or themes would have
62+
// added for themselves.
63+
WP_CLI::add_hook(
64+
'before_wp_load',
65+
static function () {
66+
$arguments = WP_CLI::get_runner()->arguments;
67+
68+
if ( isset( $arguments[0] ) && in_array( $arguments[0], [ 'plugin', 'theme' ], true ) ) {
69+
\WP_CLI\CommandWithUpgrade::discard_update_data_stored_while_skipping();
70+
}
71+
}
72+
);

‎features/plugin-install.feature‎

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ Feature: Install WordPress plugins
310310
Scenario: Can't install plugin that requires a newer version of PHP
311311
Given a WP install
312312

313-
And I try `wp plugin install contact-form-7`
313+
And I try `wp plugin install wp-mail-smtp`
314314
Then STDERR should contain:
315315
"""
316-
Warning: contact-form-7: This plugin does not work with your version of PHP
316+
Warning: wp-mail-smtp: This plugin does not work with your version of PHP
317317
"""
318318

319319
And STDERR should contain:
@@ -550,3 +550,98 @@ Feature: Install WordPress plugins
550550
Error: The --slug option can only be used when installing a single item.
551551
"""
552552
And the return code should be 1
553+
554+
@require-wp-5.5
555+
Scenario Outline: Install plugin from a zip file with an unmet <requirement> requirement using --ignore-requirements
556+
Given a WP install
557+
And a requires-plugin/requires-plugin.php file:
558+
"""
559+
<?php
560+
/**
561+
* Plugin Name: Requires Plugin
562+
* Version: 1.0.0
563+
* <requirement>: 99.0
564+
*/
565+
"""
566+
And a make-zip.php file:
567+
"""
568+
<?php
569+
$zip = new ZipArchive();
570+
$zip->open( 'requires-plugin.zip', ZipArchive::CREATE );
571+
$zip->addFile( 'requires-plugin/requires-plugin.php' );
572+
$zip->close();
573+
"""
574+
575+
When I run `wp eval-file make-zip.php --skip-wordpress`
576+
Then the return code should be 0
577+
578+
When I try `wp plugin install requires-plugin.zip`
579+
Then STDERR should contain:
580+
"""
581+
<message>
582+
"""
583+
And STDERR should contain:
584+
"""
585+
however the uploaded plugin requires 99.0.
586+
"""
587+
And STDERR should contain:
588+
"""
589+
Error: No plugins installed.
590+
"""
591+
And the wp-content/plugins/requires-plugin directory should not exist
592+
And the return code should be 1
593+
594+
When I run `wp plugin install requires-plugin.zip --ignore-requirements`
595+
Then STDOUT should contain:
596+
"""
597+
Plugin installed successfully.
598+
"""
599+
And the wp-content/plugins/requires-plugin/requires-plugin.php file should exist
600+
601+
When I run `wp plugin install requires-plugin.zip --ignore-requirements --slug=custom-requires-plugin`
602+
Then STDOUT should contain:
603+
"""
604+
Renamed 'requires-plugin' to 'custom-requires-plugin'.
605+
"""
606+
And STDOUT should contain:
607+
"""
608+
Plugin installed successfully.
609+
"""
610+
And the wp-content/plugins/custom-requires-plugin/requires-plugin.php file should exist
611+
612+
Examples:
613+
| requirement | message |
614+
| Requires at least | Your WordPress version is |
615+
| Requires PHP | The PHP version on your server is |
616+
617+
@require-wp-5.5
618+
Scenario: Install invalid plugin zip file using --ignore-requirements
619+
Given a WP install
620+
And a not-a-plugin/not-a-plugin.php file:
621+
"""
622+
<?php
623+
// Not a plugin.
624+
"""
625+
And a make-zip.php file:
626+
"""
627+
<?php
628+
$zip = new ZipArchive();
629+
$zip->open( 'not-a-plugin.zip', ZipArchive::CREATE );
630+
$zip->addFile( 'not-a-plugin/not-a-plugin.php' );
631+
$zip->close();
632+
"""
633+
634+
When I run `wp eval-file make-zip.php --skip-wordpress`
635+
Then the return code should be 0
636+
637+
When I try `wp plugin install not-a-plugin.zip --ignore-requirements`
638+
Then STDERR should contain:
639+
"""
640+
No valid plugins were found.
641+
"""
642+
And STDERR should contain:
643+
"""
644+
Error: No plugins installed.
645+
"""
646+
And the wp-content/plugins/not-a-plugin directory should not exist
647+
And the return code should be 1

‎features/plugin-list-wporg-status.feature‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Feature: Check the status of plugins on WordPress.org
33
@require-wp-5.2
44
Scenario: Install plugins and check the status on wp.org.
55
Given a WP install
6-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
6+
And these installed plugins:
7+
"""
8+
wordpress-importer --version=0.5 --force
9+
"""
710
And I run `wp plugin install https://downloads.wordpress.org/plugin/no-longer-in-directory.1.0.62.zip`
811
And a wp-content/plugins/never-wporg/never-wporg.php file:
912
"""
@@ -114,7 +117,10 @@ Feature: Check the status of plugins on WordPress.org
114117
@require-wp-5.2
115118
Scenario: The wp.org last updated date for an active plugin does not depend on a second, rate-limited request
116119
Given a WP install
117-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
120+
And these installed plugins:
121+
"""
122+
wordpress-importer --version=0.5 --force
123+
"""
118124
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
119125
"""
120126
HTTP/1.1 200
@@ -146,7 +152,10 @@ Feature: Check the status of plugins on WordPress.org
146152
@require-wp-5.2
147153
Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API omits it
148154
Given a WP install
149-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
155+
And these installed plugins:
156+
"""
157+
wordpress-importer --version=0.5 --force
158+
"""
150159
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
151160
"""
152161
HTTP/1.1 200
@@ -180,7 +189,10 @@ Feature: Check the status of plugins on WordPress.org
180189
@require-wp-5.2
181190
Scenario: The wp.org last updated date falls back to the trac log when the plugin-info API date can't be parsed
182191
Given a WP install
183-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
192+
And these installed plugins:
193+
"""
194+
wordpress-importer --version=0.5 --force
195+
"""
184196
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
185197
"""
186198
HTTP/1.1 200
@@ -217,7 +229,10 @@ Feature: Check the status of plugins on WordPress.org
217229
@require-wp-5.2
218230
Scenario: The wp.org last updated date stays empty when the trac log pubDate can't be parsed
219231
Given a WP install
220-
And I run `wp plugin install wordpress-importer --version=0.5 --force`
232+
And these installed plugins:
233+
"""
234+
wordpress-importer --version=0.5 --force
235+
"""
221236
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
222237
"""
223238
HTTP/1.1 200

‎features/plugin-uninstall.feature‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ Feature: Uninstall a WordPress plugin
159159
@require-wp-5.2
160160
Scenario: Uninstalling a plugin should remove its language pack
161161
Given a WP install
162-
And I run `wp plugin install wordpress-importer`
162+
And these installed plugins:
163+
"""
164+
wordpress-importer
165+
"""
163166
And I run `wp language core install fr_FR`
164167
And I run `wp site switch-language fr_FR`
165168

@@ -185,7 +188,10 @@ Feature: Uninstall a WordPress plugin
185188
@require-wp-5.2
186189
Scenario: Uninstalling a plugin should remove its update info
187190
Given a WP install
188-
And I run `wp plugin install wordpress-importer --version=0.6`
191+
And these installed plugins:
192+
"""
193+
wordpress-importer --version=0.6
194+
"""
189195
And I try `wp plugin status wordpress-importer`
190196

191197
And I run `wp transient get --network update_plugins`

0 commit comments

Comments
 (0)