Multisite: Clear incomplete objects from cache in `get_blog_details()` when found.
In [37657], the `blog_id` and `site_id` properties were changed to private. Any `WP_Site` objects previously stored in cache with public properties should now be considered invalid. We can detect this by checking for these missing properties and clearing the dirty cache if found. Props flixos90. Fixes #36717. Built from https://develop.svn.wordpress.org/trunk@37874 git-svn-id: http://core.svn.wordpress.org/trunk@37815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bf2bea4987
commit
9edd8df844
|
@ -183,6 +183,10 @@ function get_blog_details( $fields = null, $get_all = true ) {
|
|||
wp_cache_delete( $blog_id . $all, 'blog-details' );
|
||||
unset($details);
|
||||
}
|
||||
} elseif ( ! $details->blog_id || ! $details->site_id ) {
|
||||
// Clear objects missing critical properties.
|
||||
wp_cache_delete( $blog_id . $all, 'blog-details' );
|
||||
unset($details);
|
||||
} else {
|
||||
return $details;
|
||||
}
|
||||
|
@ -203,13 +207,17 @@ function get_blog_details( $fields = null, $get_all = true ) {
|
|||
wp_cache_delete( $blog_id, 'blog-details' );
|
||||
unset($details);
|
||||
}
|
||||
} elseif ( ! $details->blog_id || ! $details->site_id ) {
|
||||
// Clear objects missing critical properties.
|
||||
wp_cache_delete( $blog_id, 'blog-details' );
|
||||
unset($details);
|
||||
} else {
|
||||
return $details;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($details) ) {
|
||||
if ( empty( $details ) || ! $details->blog_id || ! $details->site_id ) {
|
||||
$details = WP_Site::get_instance( $blog_id );
|
||||
if ( ! $details ) {
|
||||
// Set the full cache.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37873';
|
||||
$wp_version = '4.6-alpha-37874';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue