Networks and Sites: Load WP_Metadata_Lazyloader class file if class does not exist.

Follow on from [55747].

As `get_sites` can be called very early in the bootstrap process, like in the sunrise.php file, it means that the `WP_Metadata_Lazyloader` may not have been loaded yet in the wp-settings.php file. Add a simple check to see if the class exists and if it does not exist then load the class file in. 

Props spacedmonkey, peterwilsoncc, dd32.
See #58185.
Built from https://develop.svn.wordpress.org/trunk@55818


git-svn-id: http://core.svn.wordpress.org/trunk@55330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-05-17 09:44:18 +00:00
parent 2949e05862
commit c459098d7b
2 changed files with 4 additions and 1 deletions

View File

@ -1214,6 +1214,9 @@ function wp_metadata_lazyloader() {
static $wp_metadata_lazyloader;
if ( null === $wp_metadata_lazyloader ) {
if ( ! class_exists( 'WP_Metadata_Lazyloader' ) ) {
require_once ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php';
}
$wp_metadata_lazyloader = new WP_Metadata_Lazyloader();
}

View File

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