Skip to content

Commit 9d07ac1

Browse files
authored
Merge branch 'main' into patch-1
2 parents 0a9a015 + 8ecef74 commit 9d07ac1

12 files changed

Lines changed: 497 additions & 168 deletions

‎.github/dependabot.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ updates:
77
open-pull-requests-limit: 10
88
labels:
99
- scope:distribution
10+
cooldown:
11+
default-days: 7
1012
- package-ecosystem: github-actions
1113
directory: "/"
1214
schedule:
1315
interval: daily
1416
open-pull-requests-limit: 10
1517
labels:
1618
- scope:distribution
19+
cooldown:
20+
default-days: 7
1721

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Checkout code
24-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
24+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2525
with:
2626
persist-credentials: false
2727

@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: Set up PHP environment
3333
if: steps.check_composer_file.outputs.files_exists == 'true'
34-
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
34+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
3535
with:
3636
php-version: 'latest'
3737
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On

‎.github/workflows/issue-triage.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ name: Issue and PR Triage
1616
permissions:
1717
issues: write
1818
pull-requests: write
19-
actions: write
2019
contents: read
2120
models: read
21+
# A caller can only cap a reusable workflow's permissions, never raise them,
22+
# so `actions: write` has to be granted here for the dispatch job downstream
23+
# to work at all. The reusable workflow narrows it to that single job, so the
24+
# `pull_request_target` job does not receive it. Removing it here breaks
25+
# dispatching (see #271/#272); narrow it there instead.
26+
actions: write
2227

2328
jobs:
2429
issue-triage:

‎README.md‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ wp db cli [--database=<database>] [--default-character-set=<character-set>] [--d
338338
Executes a SQL query against the database.
339339

340340
~~~
341-
wp db query [<sql>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--defaults]
341+
wp db query [<sql>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--defaults] [--skip-sql-mode-compat]
342342
~~~
343343

344344
Executes an arbitrary SQL query using `DB_HOST`, `DB_NAME`, `DB_USER`
@@ -365,6 +365,13 @@ entirely.
365365
[--defaults]
366366
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
367367

368+
[--skip-sql-mode-compat]
369+
Run the query under the server's own SQL modes instead of adapting them to
370+
be WordPress-compatible. By default, the incompatible modes that WordPress
371+
disables in `wpdb` (such as `NO_ZERO_DATE` and `STRICT_TRANS_TABLES`) are
372+
stripped for the session, so statements against WordPress's zero-date schema
373+
behave the same as they do in WordPress itself.
374+
368375
**EXAMPLES**
369376

370377
# Execute a query stored in a file
@@ -437,7 +444,7 @@ wp db export [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>]
437444
**Alias:** `dump`
438445

439446
Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
440-
`DB_PASSWORD` database credentials specified in wp-config.php. Accepts any valid `mysqldump` flags.
447+
`DB_PASSWORD` database credentials specified in wp-config.php. Accepts any valid [`mysqldump` flags](https://dev.mysql.com/doc/en/mysqldump.html#mysqldump-option-summary).
441448

442449
**OPTIONS**
443450

@@ -531,7 +538,7 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
531538
Imports a database from a file or from STDIN.
532539

533540
~~~
534-
wp db import [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--skip-optimization] [--defaults]
541+
wp db import [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--skip-optimization] [--skip-sql-mode-compat] [--defaults]
535542
~~~
536543

537544
Runs SQL queries using `DB_HOST`, `DB_NAME`, `DB_USER` and
@@ -554,7 +561,10 @@ defined in the SQL.
554561
Extra arguments to pass to mysql. [Refer to mysql binary docs](https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html).
555562

556563
[--skip-optimization]
557-
When using an SQL file, do not include speed optimization such as disabling auto-commit and key checks.
564+
Do not disable unique checks and foreign key checks during import.
565+
566+
[--skip-sql-mode-compat]
567+
Do not adapt the session SQL mode for WordPress compatibility. By default, `wp db import` strips the SQL modes that WordPress Core disables (such as `STRICT_TRANS_TABLES` and `NO_ZERO_DATE`) so that dumps containing legacy values like `0000-00-00` import cleanly. Pass this flag to import under the server's own SQL modes instead.
558568

559569
[--defaults]
560570
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
@@ -1046,7 +1056,7 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file
10461056

10471057
## Support
10481058

1049-
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
1059+
GitHub issues aren't for general support questions. For support resources and next steps, see the WP-CLI Support page: https://make.wordpress.org/cli/handbook/support/
10501060

10511061

10521062
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*

‎composer.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
}
1313
],
1414
"require": {
15-
"wp-cli/wp-cli": "^2.13"
15+
"wp-cli/wp-cli": "^3.0"
1616
},
1717
"require-dev": {
18-
"wp-cli/entity-command": "^1.3 || ^2",
18+
"wp-cli/entity-command": "^1.3 || ^2 || ^3",
1919
"wp-cli/wp-cli-tests": "^5"
2020
},
2121
"config": {
@@ -30,7 +30,7 @@
3030
},
3131
"extra": {
3232
"branch-alias": {
33-
"dev-main": "2.x-dev"
33+
"dev-main": "3.x-dev"
3434
},
3535
"bundled": true,
3636
"commands": [

‎features/db-check.feature‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,45 @@ Feature: Check the database
154154
Given a WP install
155155

156156
When I try `wp db check --defaults --debug`
157-
Then STDERR should match #Debug \(db\): Running shell command: /usr/bin/env (mysqlcheck|mariadb-check) %s#
157+
Then STDERR should match #Debug \(db\): Running shell command: /([^/]+/)+(mysqlcheck|mariadb-check) %s#
158158

159159
When I try `wp db check --debug`
160-
Then STDERR should match #Debug \(db\): Running shell command: /usr/bin/env (mysqlcheck|mariadb-check) --no-defaults %s#
160+
Then STDERR should match #Debug \(db\): Running shell command: /([^/]+/)+(mysqlcheck|mariadb-check) --no-defaults %s#
161161

162162
When I try `wp db check --no-defaults --debug`
163-
Then STDERR should match #Debug \(db\): Running shell command: /usr/bin/env (mysqlcheck|mariadb-check) --no-defaults %s#
163+
Then STDERR should match #Debug \(db\): Running shell command: /([^/]+/)+(mysqlcheck|mariadb-check) --no-defaults %s#
164+
165+
@require-mysql-or-mariadb
166+
Scenario: Empty DB credentials should not cause empty parameter errors
167+
Given an empty directory
168+
And WP files
169+
170+
When I run `wp config create {CORE_CONFIG_SETTINGS} --dbcharset="" --skip-check`
171+
Then STDOUT should not be empty
172+
173+
When I run `cat wp-config.php`
174+
Then STDOUT should contain:
175+
"""
176+
define( 'DB_CHARSET', '' );
177+
"""
178+
179+
When I run `wp db create`
180+
Then STDOUT should not be empty
181+
182+
When I try `wp db check --debug`
183+
Then the return code should be 0
184+
And STDOUT should contain:
185+
"""
186+
Success: Database checked.
187+
"""
188+
And STDERR should not contain:
189+
"""
190+
--default-character-set=''
191+
"""
192+
And STDERR should not contain:
193+
"""
194+
--default-character-set=
195+
"""
164196

165197
@require-sqlite
166198
Scenario: SQLite commands that show warnings

‎features/db-export.feature‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ Feature: Export a WordPress database
167167
Given a WP install
168168

169169
When I try `wp db export --defaults --debug`
170-
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump)#
170+
Then STDERR should match #Debug \(db\): Running initial shell command: /([^/]+/)+(mysqldump|mariadb-dump)#
171171

172172
When I try `wp db export --debug`
173-
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump) --no-defaults#
173+
Then STDERR should match #Debug \(db\): Running initial shell command: /([^/]+/)+(mysqldump|mariadb-dump) --no-defaults#
174174

175175
When I try `wp db export --no-defaults --debug`
176-
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump) --no-defaults#
176+
Then STDERR should match #Debug \(db\): Running initial shell command: /([^/]+/)+(mysqldump|mariadb-dump) --no-defaults#
177177

178178
@skip-sqlite
179179
@skip-windows

0 commit comments

Comments
 (0)