WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/29/2016 07:31:49 PM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Lazy load extended WP_Site properties when requested.

In the past, get_blog_details() has been used to retrieve the home, siteurl, blogname, and post_count options for a site. By lazy loading properties in a WP_Site object, we can avoid having to use get_blog_details() and instead provide the properties as needed.

This introduces the global site-details cache group in which standard objects representing the site are stored. This will one day be a replacement for the blog-details cache group that is currently used in get_blog_details().

This relies on the ms_loaded action introduced in [37916] as properties are not available via get_option() until multisite has been fully loaded.

Props flixos90.
Fixes #36935.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r37690 r37918  
    510510
    511511    if ( function_exists( 'wp_cache_add_global_groups' ) ) {
    512         wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) );
     512        wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) );
    513513        wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
    514514    }
Note: See TracChangeset for help on using the changeset viewer.