Options, Meta APIs: Prevent Single Site installs using network notoptions cache.

Modifies the caching of `notoptions` in `delete_network_option()` to ensure that the network cache is bypassed on single site installs.

On single site installs the incorrect caching was causing the `notoptions` cache to remain populated once a deleted option was subsequently added or updated.

Follow up to [58782].

Props bjorsch, pbearne.
Fixes #61730.
See #61484.


Built from https://develop.svn.wordpress.org/trunk@58811


git-svn-id: http://core.svn.wordpress.org/trunk@58207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2024-07-25 23:04:12 +00:00
parent db0c2dacbf
commit 213355eb80
2 changed files with 12 additions and 10 deletions

View File

@ -2264,6 +2264,17 @@ function delete_network_option( $network_id, $option ) {
'site_id' => $network_id,
)
);
if ( $result ) {
$notoptions_key = "$network_id:notoptions";
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
}
$notoptions[ $option ] = true;
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
}
if ( $result ) {
@ -2293,15 +2304,6 @@ function delete_network_option( $network_id, $option ) {
*/
do_action( 'delete_site_option', $option, $network_id );
$notoptions_key = "$network_id:notoptions";
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
}
$notoptions[ $option ] = true;
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
return true;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58810';
$wp_version = '6.7-alpha-58811';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.