Multisite: Do not prime site meta caches unless necessary.

Merges [44926] to the 5.1 branch.

Props spacedmonkey.
Fixes #46357. See #46167.

Built from https://develop.svn.wordpress.org/branches/5.1@44928


git-svn-id: http://core.svn.wordpress.org/branches/5.1@44759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2019-03-18 16:21:50 +00:00
parent 13aa7e4f47
commit 4860e76289
6 changed files with 40 additions and 32 deletions

View File

@ -66,6 +66,7 @@ switch ( $action ) {
'fields' => 'ids',
'order' => 'DESC',
'orderby' => 'id',
'update_site_meta_cache' => false,
)
);
if ( empty( $site_ids ) ) {

View File

@ -588,6 +588,7 @@ function get_oembed_response_data_for_url( $url, $args ) {
$qv = array(
'domain' => $url_parts['host'],
'path' => '/',
'update_site_meta_cache' => false,
);
// In case of subdirectory configs, set the path.

View File

@ -101,6 +101,7 @@ function get_id_from_blogname( $slug ) {
'fields' => 'ids',
'domain' => $domain,
'path' => $path,
'update_site_meta_cache' => false,
)
);

View File

@ -349,6 +349,7 @@ function get_blog_id_from_url( $domain, $path = '/' ) {
'path' => $path,
'fields' => 'ids',
'number' => 1,
'update_site_meta_cache' => false,
);
$result = get_sites( $args );
$id = array_shift( $result );
@ -1478,6 +1479,7 @@ function domain_exists( $domain, $path, $network_id = 1 ) {
'path' => $path,
'fields' => 'ids',
'number' => 1,
'update_site_meta_cache' => false,
);
$result = get_sites( $args );
$result = array_shift( $result );
@ -2438,6 +2440,7 @@ function wp_update_network_site_counts( $network_id = null ) {
'deleted' => 0,
'archived' => 0,
'count' => true,
'update_site_meta_cache' => false,
)
);

View File

@ -236,6 +236,7 @@ function get_site_by_path( $domain, $path, $segments = null ) {
$args = array(
'number' => 1,
'update_site_meta_cache' => false,
);
if ( count( $domains ) > 1 ) {

View File

@ -682,6 +682,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
$args = array(
'number' => '',
'site__in' => $site_ids,
'update_site_meta_cache' => false,
);
if ( ! $all ) {
$args['archived'] = 0;