Skip to content

Print full database error for ms_not_installed #5948

@rmccue

Description

@rmccue

Feature Request

Describe your use case and the problem you are facing

When an error occurs in the sunrise process (ms-settings.php), wp-cli prints the basic Error: Error establishing a database connection. message with no further context or information. This makes it hard to understand the actual error which is occurring; i.e. did wp-cli fail to connect to the database, or was it unable to resolve the domain in multisite?

We see customers hit this all the time after performing a database migration and forgetting to run a search-replace, running an incomplete search-replace, or forgetting to clear the object cache.

Describe the solution you'd like

This error typically happens when ms_load_current_site_and_network() in ms-settings is unable to resolve the domain, triggering ms_not_installed(). ms_not_installed() only prints a detailed error if is_admin(), otherwise printing the generic error.

wp-cli should instead show the detailed information that ms_not_installed() shows; namely, if the database table is missing or if the searched row is missing.

(p.s. wp-cli does show the Error: Site 'example.com/' not found. error in some cases, working on working out why it doesn't in this case)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions