wp-cli / wp-cli

⚙️ WP-CLI framework
https://wp-cli.org/
MIT License
4.88k stars 984 forks source link

I don't seem to have the latest version of `db search` after update to v2.11.0 #5969

Open rosswintle opened 3 months ago

rosswintle commented 3 months ago

Bug Report

Describe the current, buggy behavior

After an update to wp-cli version 2.11.0 I do not seem to have the --format flag on the wp db search command.

I noticed that version 2.11.0 of WP-CLI included an update to the db search command to add a --format option.

I wanted to try this out, so I did wp cli update on my local machine, but I don't seem to have this new option.

I can replicate this by installing the latest wp-cli fresh and running wp help db search

$ wp cli version
WP-CLI 2.11.0

$ wp help db search

NAME

  wp db search

DESCRIPTION

  Finds a string in the database.

SYNOPSIS

  wp db search <search> [<tables>...] [--network] [--all-tables-with-prefix] [--all-tables] [--before_context=<num>]
  [--after_context=<num>] [--regex] [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>]
  [--table_column_once] [--one_line] [--matches_only] [--stats] [--table_column_color=<color_code>]
  [--id_color=<color_code>] [--match_color=<color_code>]

  Searches through all of the text columns in a selection of database tables for a given string, Outputs colorized
  references to the string.

  Defaults to searching through all tables registered to $wpdb. On multisite, this default is limited to the tables
  for the current site.

OPTIONS
...

Describe how other contributors can replicate this bug

  1. Create a new directory using mkdir wp-cli-test and enter it
  2. Install wp-cli: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  3. Run php ./wp-cli/phar help db search
  4. You should not see the --format parameter
  5. Change directory to a WordPress installation
  6. Run php <directory>/wp-cli-test/wp-cli.phar db search --format
  7. You should see:
Error: Parameter errors:
 unknown --format parameter

Describe what you expect as the correct outcome

The db search command should have a --format option/parameter

Let us know what environment you are running this on

OS: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103 arm64
Shell:  /bin/zsh
PHP binary: /opt/homebrew/Cellar/php@8.2/8.2.21/bin/php
PHP version:    8.2.21
php.ini used:   /opt/homebrew/etc/php/8.2/php.ini
MySQL binary:   /opt/homebrew/bin/mysql
MySQL version:  mysql  Ver 8.3.0 for macos14.2 on arm64 (Homebrew)
SQL modes:
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /Users/rosswintle/side-projects/rosswintle
WP-CLI packages dir:    /Users/rosswintle/.wp-cli/packages/
WP-CLI cache dir:   /Users/rosswintle/.wp-cli/cache
WP-CLI global config:   /Users/rosswintle/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 2.11.0
ernilambar commented 3 months ago

I am seeing --format argument in db search:

wp db search <search> [<tables>...] [--network] [--all-tables-with-prefix] [--all-tables] [--before_context=<num>] [--after_context=<num>] [--regex]
  [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>] [--table_column_once] [--one_line] [--matches_only] [--stats]
  [--table_column_color=<color_code>] [--id_color=<color_code>] [--match_color=<color_code>] [--fields=<fields>] [--format=<format>]

Using: WP-CLI 2.11

schlessera commented 3 months ago

@rosswintle Check with wp package list to see if you might have a custom version of the wp-cli/db-command package installed.

rosswintle commented 3 months ago

No, I get:

+----------------------------------+------------------+------------+-----------+----------------+
| name                             | authors          | version    | update    | update_version |
+----------------------------------+------------------+------------+-----------+----------------+
| aaemnnosttv/wp-cli-valet-command | Evan Mattson     | dev-master | available | dev-master     |
| wp-cli/admin-command             |                  | dev-master | none      |                |
| wp-cli/dist-archive-command      | Daniel Bachhuber | dev-master | none      |                |
+----------------------------------+------------------+------------+-----------+----------------+
rosswintle commented 3 months ago

Some more information:

My regular wp-cli is in ~/wp-cli. I've looked in ~/wp-cli/vendor/wp-cli/db-command/src/DB_Command.php and this is not the up-to-date DB command. It does NOT have the --format option.

I also have a ~/.wp-cli and I've looked in ~/.wp-cli/packages/vendor/wp-cli/db-command/src/DB_Command.php and that is also not up to date.

Where should I expect to see up-to-date command package files?