db-command icon indicating copy to clipboard operation
db-command copied to clipboard

wp db check doesn't return error if core WP tables are missing

Open benlk opened this issue 6 years ago • 0 comments

Bug Report

Describe the current, buggy behavior

With a database that only contains the posts table from wordpress:

$ wp db check
example.wp_posts                          OK
Success: Database checked.

This check returns a success, despite the database missing most of WordPress' core database tables.

Steps to reproduce

This database was created by wp db importing a botched phpMyAdmin export, which contained only a single table rather than all tables.

You could also probably get similar behavior by selectively deleting tables from an install.

Describe what you would expect as the correct outcome

I would expect an error to be output if any of the tables created by WordPress Core are missing.

Let us know what environment you are running this on

$ wp cli info
OS:	Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64
Shell:	/bin/bash
PHP binary:	/usr/local/Cellar/php/7.3.5/bin/php
PHP version:	7.3.5
php.ini used:	/usr/local/etc/php/7.3/php.ini
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/user/sites/example
WP-CLI packages dir:	/Users/user/wp-cli/packages/
WP-CLI global config:	
WP-CLI project config:	
WP-CLI version:	2.3.0

benlk avatar Sep 17 '19 20:09 benlk