Skip to content

Commit d5cb769

Browse files
authored
Merge branch 'main' into copilot/add-wp-db-status-command
2 parents 8dfc5d0 + 4de3dfa commit d5cb769

10 files changed

Lines changed: 220 additions & 113 deletions

File tree

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ on:
99
paths:
1010
- .github/workflows/copilot-setup-steps.yml
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
copilot-setup-steps:
17+
name: Setup environment
1418
runs-on: ubuntu-latest
1519
permissions:
1620
contents: read
1721

1822
steps:
1923
- name: Checkout code
2024
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
with:
26+
persist-credentials: false
2127

2228
- name: Check existence of composer.json file
2329
id: check_composer_file
2430
run: echo "files_exists=$(test -f composer.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
2531

2632
- name: Set up PHP environment
2733
if: steps.check_composer_file.outputs.files_exists == 'true'
28-
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
34+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
2935
with:
3036
php-version: 'latest'
3137
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -36,9 +42,6 @@ jobs:
3642

3743
- name: Install Composer dependencies & cache dependencies
3844
if: steps.check_composer_file.outputs.files_exists == 'true'
39-
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v3
45+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
4046
env:
4147
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
42-
with:
43-
# Bust the cache at least once a month - output format: YYYY-MM.
44-
custom-cache-suffix: $(date -u "+%Y-%m")

‎README.md‎

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ wp-cli/db-command
33

44
Performs basic database operations using credentials stored in wp-config.php.
55

6-
[![Testing](https://github.com/wp-cli/db-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/db-command/actions/workflows/testing.yml)
6+
[![Testing](https://github.com/wp-cli/db-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/db-command/actions/workflows/testing.yml) [![Code Coverage](https://codecov.io/gh/wp-cli/db-command/branch/main/graph/badge.svg)](https://codecov.io/gh/wp-cli/db-command/tree/main)
77

88
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)
99

@@ -431,7 +431,7 @@ To confirm the ID for the site you want to query, you can use the `wp site list`
431431
Exports the database to a file or to STDOUT.
432432

433433
~~~
434-
wp db export [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--tables=<tables>] [--exclude_tables=<tables>] [--include-tablespaces] [--porcelain] [--add-drop-table] [--defaults]
434+
wp db export [<file>] [--dbuser=<value>] [--dbpass=<value>] [--<field>=<value>] [--tables=<tables>] [--exclude_tables=<tables>] [--include-tablespaces] [--porcelain] [--defaults]
435435
~~~
436436

437437
**Alias:** `dump`
@@ -466,16 +466,13 @@ Runs `mysqldump` utility using `DB_HOST`, `DB_NAME`, `DB_USER` and
466466
[--porcelain]
467467
Output filename for the exported database.
468468

469-
[--add-drop-table]
470-
Include a `DROP TABLE IF EXISTS` statement before each `CREATE TABLE` statement.
471-
472469
[--defaults]
473470
Loads the environment's MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration.
474471

475472
**EXAMPLES**
476473

477-
# Export database with drop query included
478-
$ wp db export --add-drop-table
474+
# Export database with `--skip-opt` and `--add-drop-table` mysqldump flags
475+
$ wp db export --skip-opt --add-drop-table
479476
Success: Exported to 'wordpress_dbase-db72bb5.sql'.
480477

481478
# Export certain tables
@@ -648,39 +645,39 @@ Defaults to searching through all tables registered to $wpdb. On multisite, this
648645
- count
649646
---
650647

651-
The percent color codes available are:
652-
653-
| Code | Color
654-
| ---- | -----
655-
| %y | Yellow (dark) (mustard)
656-
| %g | Green (dark)
657-
| %b | Blue (dark)
658-
| %r | Red (dark)
659-
| %m | Magenta (dark)
660-
| %c | Cyan (dark)
661-
| %w | White (dark) (light gray)
662-
| %k | Black
663-
| %Y | Yellow (bright)
664-
| %G | Green (bright)
665-
| %B | Blue (bright)
666-
| %R | Red (bright)
667-
| %M | Magenta (bright)
668-
| %C | Cyan (bright)
669-
| %W | White
670-
| %K | Black (bright) (dark gray)
671-
| %3 | Yellow background (dark) (mustard)
672-
| %2 | Green background (dark)
673-
| %4 | Blue background (dark)
674-
| %1 | Red background (dark)
675-
| %5 | Magenta background (dark)
676-
| %6 | Cyan background (dark)
677-
| %7 | White background (dark) (light gray)
678-
| %0 | Black background
679-
| %8 | Reverse
680-
| %U | Underline
681-
| %F | Blink (unlikely to work)
682-
683-
They can be concatenated. For instance, the default match color of black on a mustard (dark yellow) background `%3%k` can be made black on a bright yellow background with `%Y%0%8`.
648+
The percent color codes available are:
649+
650+
| Code | Color
651+
| ---- | -----
652+
| %y | Yellow (dark) (mustard)
653+
| %g | Green (dark)
654+
| %b | Blue (dark)
655+
| %r | Red (dark)
656+
| %m | Magenta (dark)
657+
| %c | Cyan (dark)
658+
| %w | White (dark) (light gray)
659+
| %k | Black
660+
| %Y | Yellow (bright)
661+
| %G | Green (bright)
662+
| %B | Blue (bright)
663+
| %R | Red (bright)
664+
| %M | Magenta (bright)
665+
| %C | Cyan (bright)
666+
| %W | White
667+
| %K | Black (bright) (dark gray)
668+
| %3 | Yellow background (dark) (mustard)
669+
| %2 | Green background (dark)
670+
| %4 | Blue background (dark)
671+
| %1 | Red background (dark)
672+
| %5 | Magenta background (dark)
673+
| %6 | Cyan background (dark)
674+
| %7 | White background (dark) (light gray)
675+
| %0 | Black background
676+
| %8 | Reverse
677+
| %U | Underline
678+
| %F | Blink (unlikely to work)
679+
680+
They can be concatenated. For instance, the default match color of black on a mustard (dark yellow) background `%3%k` can be made black on a bright yellow background with `%Y%0%8`.
684681

685682
**AVAILABLE FIELDS**
686683

@@ -759,7 +756,22 @@ Defaults to all tables registered to the $wpdb database handler.
759756
List tables based on wildcard search, e.g. 'wp_*_options' or 'wp_post?'.
760757

761758
[--scope=<scope>]
762-
Can be all, global, ms_global, blog, or old tables. Defaults to all.
759+
List tables based on the scope.
760+
761+
- all: returns 'all' and 'global' tables. No old tables are returned.
762+
- blog: returns the blog-level tables for the queried blog.
763+
- global: returns the global tables for the installation, returning multisite tables only on multisite.
764+
- ms_global: returns the multisite global tables, regardless if current installation is multisite.
765+
- old: returns tables which are deprecated.
766+
---
767+
default: all
768+
options:
769+
- all
770+
- blog
771+
- global
772+
- ms_global
773+
- old
774+
---
763775

764776
[--network]
765777
List all the tables in a multisite install.
@@ -1020,6 +1032,10 @@ Want to contribute a new feature? Please first [open a new issue](https://github
10201032

10211033
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
10221034

1035+
### License
1036+
1037+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
1038+
10231039
## Support
10241040

10251041
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support

‎codecov.yml‎

Whitespace-only changes.

‎features/db-export.feature‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,16 @@ Feature: Export a WordPress database
147147

148148
When I try `wp db export --no-defaults --debug`
149149
Then STDERR should match #Debug \(db\): Running initial shell command: /usr/bin/env (mysqldump|mariadb-dump) --no-defaults#
150+
151+
@skip-sqlite
152+
@skip-windows
153+
Scenario: Export database when PHP exec() is disabled
154+
Given a WP install
155+
156+
When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--ddisable_functions=exec} db export wp_cli_test.sql --porcelain`
157+
Then the return code should be 0
158+
And STDOUT should contain:
159+
"""
160+
wp_cli_test.sql
161+
"""
162+
And the wp_cli_test.sql file should exist

0 commit comments

Comments
 (0)