Multisite: Ensure site meta caches are not primed unless the wp_blogmeta table is available.

Prior to this change, querying sites early in the bootstrap process could potentially cause a fatal error, since at that stage the filter to bail on updating site meta cache if the respective database table has not been installed yet is not hooked in yet. This changeset forces the filter to be added if that is not already the case.

Props spacedmonkey.
Fixes #46167.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2019-03-18 15:49:00 +00:00
parent e901bc4c2b
commit 0607371f84
2 changed files with 5 additions and 1 deletions

View File

@ -380,6 +380,10 @@ function update_site_cache( $sites, $update_meta_cache = true ) {
* @return array|false Returns false if there is nothing to update. Returns an array of metadata on success. * @return array|false Returns false if there is nothing to update. Returns an array of metadata on success.
*/ */
function update_sitemeta_cache( $site_ids ) { function update_sitemeta_cache( $site_ids ) {
// Ensure this filter is hooked in even if the function is called early.
if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) {
add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
}
return update_meta_cache( 'blog', $site_ids ); return update_meta_cache( 'blog', $site_ids );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-alpha-44924'; $wp_version = '5.2-alpha-44925';
/** /**
* 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.