WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 22 months ago

#42262 closed enhancement (wontfix)

Permit execution of wp_cache_flush() on multisite before ms-settings.php is loaded

Reported by: danielbachhuber Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bootstrap/Load Keywords: needs-patch
Focuses: multisite Cc:
PR Number:

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).

Related https://github.com/wp-cli/cache-command/issues/17

Change History (2)

#1 @danielbachhuber
2 years ago

Huh. Now that I've published this, ms_network_not_found could work just fine.

#2 @schlessera
22 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing this as resolved-wontfix here, as the specific issue mentioned in the ticket has been solved in WP-CLI using ms_network_not_found.

Note: See TracTickets for help on using tickets.