[wp-trac] [WordPress Trac] #42262: Permit execution of wp_cache_flush() on multisite before ms-settings.php is loaded
WordPress Trac
noreply at wordpress.org
Wed Oct 18 18:33:34 UTC 2017
#42262: Permit execution of wp_cache_flush() on multisite before ms-settings.php is
loaded
-----------------------------+----------------------------
Reporter: danielbachhuber | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Bootstrap/Load | Version:
Severity: normal | Keywords: needs-patch
Focuses: multisite |
-----------------------------+----------------------------
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).
Related https://github.com/wp-cli/cache-command/issues/17
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42262>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list