Multisite: Allow falsy properties to be cached in `site-details`.

In previous iterations of `WP_Site`, there was concern that not all properties would be available when storing a site's details in cache. When introduced in [37918], an `ms_loaded` check was added to address this concern. Any properties that are still `false` after `ms_loaded` really are `false` and can be cached as such.

Props flixos90.
Fixes #40247.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2017-03-28 02:32:44 +00:00
parent fa5f2d1fa2
commit 6530f5f5f2
2 changed files with 2 additions and 12 deletions

View File

@ -333,17 +333,7 @@ final class WP_Site {
$details->home = get_option( 'home' ); $details->home = get_option( 'home' );
restore_current_blog(); restore_current_blog();
$cache_details = true; wp_cache_set( $this->blog_id, $details, 'site-details' );
foreach ( array( 'blogname', 'siteurl', 'post_count', 'home' ) as $field ) {
if ( false === $details->$field ) {
$cache_details = false;
break;
}
}
if ( $cache_details ) {
wp_cache_set( $this->blog_id, $details, 'site-details' );
}
} }
/** This filter is documented in wp-includes/ms-blogs.php */ /** This filter is documented in wp-includes/ms-blogs.php */

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-40343'; $wp_version = '4.8-alpha-40344';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.