Skip to content

Rewrite wp_get_table_names to deal correctly with wildcards.#4624

Merged
schlessera merged 6 commits intomasterfrom
issue-73-wp_get_table_names
Jan 24, 2018
Merged

Rewrite wp_get_table_names to deal correctly with wildcards.#4624
schlessera merged 6 commits intomasterfrom
issue-73-wp_get_table_names

Conversation

@gitlost
Copy link
Contributor

@gitlost gitlost commented Jan 19, 2018

See issue wp-cli/db-command#73 and PRs wp-cli/db-command#78 and #4606

Rewrites Utils\wp_get_table_names() to deal correctly with wildcards by getting the WP tables first and then filtering through the $args.

It's a backward compatibility (BC) change in that various buggy behaviours no longer happen, eg wp db tables no_such_table will return an error rather than no_such_table.

Also introduces some avoidable BC breaks:

  • scope is not ignored when network given (it doesn't make sense to me that it should be).
  • the tables are always returned sorted (rather than in wpdb order currently if not given all-tables or all-tables-with-prefix).

Also adds Utils\esc_sql_ident() from DB_Command to utils.php.

(May fail phpcs at the moment - let's see!)

Edit: will break tests for db-command/features/db-search.feature and db-command/features/db-tables.feature and search-replace-command/features/search-replace-export.feature and search-replace-command/features/search-replace.feature until they're adjusted.

@gitlost gitlost added this to the 1.5.0 milestone Jan 19, 2018
@gitlost gitlost requested a review from a team January 21, 2018 17:16
wp_posts
"""

Scenario: Get WP table names for single site install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single site install => multisite install

@schlessera schlessera merged commit b8e0753 into master Jan 24, 2018
@schlessera schlessera deleted the issue-73-wp_get_table_names branch January 24, 2018 10:36
@schlessera
Copy link
Member

Big props to @BhargavBhandari90 for doing a lot of the preliminary work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants