Skip to content

Commit 8cb57b6

Browse files
committed
Merge branch 'main' into patch-1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
2 parents 11085bf + 9423837 commit 8cb57b6

13 files changed

Lines changed: 526 additions & 220 deletions

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
id: check_behat_file
4747
run: echo "files_exists=$(test -f behat.yml && echo true || echo false)" >> "$GITHUB_OUTPUT"
4848

49-
# Downloading and starting the database server is the slowest part of the
50-
# setup and it is independent of PHP and Composer, so it runs in the
51-
# background and is waited for right before the test database is prepared.
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.
5253
- name: Setup MySQL Server
5354
if: steps.check_behat_file.outputs.files_exists == 'true'
54-
background: true
55-
uses: shogo82148/actions-setup-mysql@1d4ebc60ba1227dd13fc7e6ba845bd3997928d75 # v1
55+
uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1
5656
with:
5757
mysql-version: '8.0' # Standard MySQL version for these tests
5858
auto-start: true
@@ -62,7 +62,7 @@ jobs:
6262

6363
- name: Set up PHP environment
6464
if: steps.check_composer_file.outputs.files_exists == 'true'
65-
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
65+
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
6666
with:
6767
php-version: 'latest'
6868
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -77,9 +77,6 @@ jobs:
7777
env:
7878
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
7979

80-
- name: Wait for the MySQL server
81-
wait-all:
82-
8380
- name: Remove system MySQL binary
8481
if: steps.check_behat_file.outputs.files_exists == 'true'
8582
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:

‎README.md‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,17 @@ Defaults to all tables registered to the $wpdb database handler.
834834
Displays the database name and size.
835835

836836
~~~
837-
wp db size [--size_format=<format>] [--tables] [--human-readable] [--format=<format>] [--scope=<scope>] [--network] [--decimals=<decimals>] [--all-tables-with-prefix] [--all-tables] [--order=<order>] [--orderby=<orderby>]
837+
wp db size [--size_format=<format>] [--tables] [--human-readable] [--fields=<fields>] [--format=<format>] [--scope=<scope>] [--network] [--decimals=<decimals>] [--all-tables-with-prefix] [--all-tables] [--order=<order>] [--orderby=<orderby>]
838838
~~~
839839

840840
Display the database name and size for `DB_NAME` specified in wp-config.php.
841841
The size defaults to a human-readable number.
842842

843+
The reported size is the sum of the data and the index size. Both can be
844+
displayed separately by adding them to `--fields`. For SQLite, the database
845+
size is the size of the database file, which also includes overhead such as
846+
free pages.
847+
843848
Available size formats include:
844849
* b (bytes)
845850
* kb (kilobytes)
@@ -884,6 +889,9 @@ Available size formats include:
884889
[--human-readable]
885890
Display database sizes in human readable formats.
886891

892+
[--fields=<fields>]
893+
Get a specific subset of the fields.
894+
887895
[--format=<format>]
888896
Render output in a particular format.
889897
---
@@ -901,7 +909,7 @@ Available size formats include:
901909
List all the tables in a multisite install.
902910

903911
[--decimals=<decimals>]
904-
Number of digits after decimal point. Defaults to 0.
912+
Number of digits after decimal point. Defaults to 0, or 2 when using --human-readable.
905913

906914
[--all-tables-with-prefix]
907915
List all tables that match the table prefix even if not registered on $wpdb. Overrides --network.
@@ -927,6 +935,18 @@ Available size formats include:
927935
- size
928936
---
929937

938+
**AVAILABLE FIELDS**
939+
940+
These fields will be displayed by default:
941+
942+
* Name
943+
* Size
944+
945+
These fields are optionally available:
946+
947+
* Data
948+
* Index
949+
930950
**EXAMPLES**
931951

932952
$ wp db size
@@ -954,6 +974,13 @@ Available size formats include:
954974
| wp_commentmeta | 48 KB |
955975
+-----------------------+-------+
956976

977+
$ wp db size --fields=Name,Data,Index,Size --human-readable
978+
+-------------------+---------+--------+---------+
979+
| Name | Data | Index | Size |
980+
+-------------------+---------+--------+---------+
981+
| wordpress_default | 3.43 GB | 2.8 GB | 6.23 GB |
982+
+-------------------+---------+--------+---------+
983+
957984
$ wp db size --size_format=b
958985
5865472
959986

‎features/db-check.feature‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: Check the database
77
When I run `wp db check`
88
Then STDOUT should contain:
99
"""
10-
wp_cli_test.wp_users
10+
{DB_NAME}.wp_users
1111
"""
1212
And STDOUT should contain:
1313
"""
@@ -28,7 +28,7 @@ Feature: Check the database
2828
When I run `wp db check --silent`
2929
Then STDOUT should not contain:
3030
"""
31-
wp_cli_test.wp_users
31+
{DB_NAME}.wp_users
3232
"""
3333
And STDOUT should contain:
3434
"""
@@ -42,7 +42,7 @@ Feature: Check the database
4242
When I run `wp db check --defaults`
4343
Then STDOUT should contain:
4444
"""
45-
wp_cli_test.wp_users
45+
{DB_NAME}.wp_users
4646
"""
4747
And STDOUT should contain:
4848
"""
@@ -56,7 +56,7 @@ Feature: Check the database
5656
When I run `wp db check --no-defaults`
5757
Then STDOUT should contain:
5858
"""
59-
wp_cli_test.wp_users
59+
{DB_NAME}.wp_users
6060
"""
6161
And STDOUT should contain:
6262
"""
@@ -67,7 +67,7 @@ Feature: Check the database
6767
Scenario: Run db check with passed-in options
6868
Given a WP install
6969

70-
When I run `wp db check --dbuser=wp_cli_test`
70+
When I run `wp db check --dbuser={DB_USER}`
7171
Then STDOUT should contain:
7272
"""
7373
Success: Database checked.
@@ -79,7 +79,7 @@ Feature: Check the database
7979
Success: Database checked.
8080
"""
8181

82-
When I run `wp db check --dbuser=wp_cli_test --dbpass=password1`
82+
When I run `wp db check --dbuser={DB_USER} --dbpass=password1`
8383
Then STDOUT should contain:
8484
"""
8585
Success: Database checked.
@@ -101,7 +101,7 @@ Feature: Check the database
101101
"""
102102
And STDOUT should be empty
103103

104-
When I try `wp db check --dbuser=wp_cli_test --verbose`
104+
When I try `wp db check --dbuser={DB_USER} --verbose`
105105
Then the return code should be 0
106106
And STDOUT should contain:
107107
"""

‎features/db-export.feature‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,59 @@ Feature: Export a WordPress database
66
When I run `wp db export --porcelain`
77
Then STDOUT should contain:
88
"""
9-
wp_cli_test-
9+
{DB_NAME}-
1010
"""
11-
And the wp_cli_test.sql file should not exist
11+
And the {DB_NAME}.sql file should not exist
1212

1313
Scenario: Database export to a specified file path
1414
Given a WP install
1515

16-
When I run `wp db export wp_cli_test.sql --porcelain`
16+
When I run `wp db export {DB_NAME}.sql --porcelain`
1717
Then STDOUT should contain:
1818
"""
19-
wp_cli_test.sql
19+
{DB_NAME}.sql
2020
"""
21-
And the wp_cli_test.sql file should exist
21+
And the {DB_NAME}.sql file should exist
2222

2323
@skip-sqlite
2424
Scenario: Exclude tables when exporting the database
2525
Given a WP install
2626

27-
When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
28-
Then the wp_cli_test.sql file should exist
29-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/
30-
And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options["`]?/
27+
When I try `wp db export {DB_NAME}.sql --exclude_tables=wp_users --porcelain`
28+
Then the {DB_NAME}.sql file should exist
29+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/
30+
And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_options["`]?/
3131

3232
@skip-sqlite
3333
Scenario: Include only specific tables when exporting the database
3434
Given a WP install
3535

36-
When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain`
37-
Then the wp_cli_test.sql file should exist
38-
And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users["`]?/
39-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/
40-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/
36+
When I try `wp db export {DB_NAME}.sql --tables=wp_users --porcelain`
37+
Then the {DB_NAME}.sql file should exist
38+
And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_users["`]?/
39+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/
40+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/
4141

4242
@require-sqlite
4343
Scenario: Exclude tables when exporting the database
4444
Given a WP install
4545

46-
When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain`
47-
Then the wp_cli_test.sql file should exist
48-
And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/
49-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/
50-
And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options["`]?/
46+
When I try `wp db export {DB_NAME}.sql --exclude_tables=wp_users --porcelain`
47+
Then the {DB_NAME}.sql file should exist
48+
And the contents of the {DB_NAME}.sql file should not match /_mysql_data_types_cache/
49+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/
50+
And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_options["`]?/
5151

5252
@require-sqlite
5353
Scenario: Include only specific tables when exporting the database
5454
Given a WP install
5555

56-
When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain`
57-
Then the wp_cli_test.sql file should exist
58-
And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/
59-
And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users["`]?/
60-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/
61-
And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/
56+
When I try `wp db export {DB_NAME}.sql --tables=wp_users --porcelain`
57+
Then the {DB_NAME}.sql file should exist
58+
And the contents of the {DB_NAME}.sql file should not match /_mysql_data_types_cache/
59+
And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_users["`]?/
60+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/
61+
And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/
6262

6363
@require-sqlite
6464
Scenario: Export database to STDOUT
@@ -180,10 +180,10 @@ Feature: Export a WordPress database
180180
Scenario: Export database when PHP exec() is disabled
181181
Given a WP install
182182

183-
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--ddisable_functions=exec} db export wp_cli_test.sql --porcelain`
183+
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--ddisable_functions=exec} db export {DB_NAME}.sql --porcelain`
184184
Then the return code should be 0
185185
And STDOUT should contain:
186186
"""
187-
wp_cli_test.sql
187+
{DB_NAME}.sql
188188
"""
189-
And the wp_cli_test.sql file should exist
189+
And the {DB_NAME}.sql file should exist

0 commit comments

Comments
 (0)