Opened 8 years ago
Closed 7 years ago
#42262 closed enhancement (wontfix)
Permit execution of wp_cache_flush() on multisite before ms-settings.php is loaded
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Bootstrap/Load | Keywords: | needs-patch |
Focuses: | multisite | Cc: |
Description
On WordPress multisite, it would be useful to be able to execute wp_cache_flush()
before ms-settings.php
is loaded.
When a WP-CLI user runs wp cache flush
against a WordPress multisite instance that has a stale domain lookup value, they'll see an error like:
Error: Site 'mstest.org/' not found. Verify DOMAIN_CURRENT_SITE matches an existing site or use `--url=<url>` to override.
To bypass the error and flush the cache, the user must run wp cache flush --url=<old-domain>
, where <old-domain>
is the stale domain lookup value.
wp_cache_flush()
doesn't require blog-specific context though, so it's safe to run as soon as the object cache is instantiated.
Open to suggestions on an implementation. One thought is to add a ms_before_load
action that WP-CLI can hook into (although it'd then need to throw an exception to pause script execution).
Huh. Now that I've published this,
ms_network_not_found
could work just fine.