-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Feature Request
- Yes, I reviewed the contribution guidelines.
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)