From 4860e7628923722cd9d848cda91df4dafc697b27 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 18 Mar 2019 16:21:50 +0000 Subject: [PATCH] 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 --- wp-admin/network/upgrade.php | 19 ++++++++++--------- wp-includes/embed.php | 5 +++-- wp-includes/ms-blogs.php | 9 +++++---- wp-includes/ms-functions.php | 31 +++++++++++++++++-------------- wp-includes/ms-load.php | 3 ++- wp-includes/user.php | 5 +++-- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/wp-admin/network/upgrade.php b/wp-admin/network/upgrade.php index 9113f74035..25a651fa69 100644 --- a/wp-admin/network/upgrade.php +++ b/wp-admin/network/upgrade.php @@ -57,15 +57,16 @@ switch ( $action ) { $site_ids = get_sites( array( - 'spam' => 0, - 'deleted' => 0, - 'archived' => 0, - 'network_id' => get_current_network_id(), - 'number' => 5, - 'offset' => $n, - 'fields' => 'ids', - 'order' => 'DESC', - 'orderby' => 'id', + 'spam' => 0, + 'deleted' => 0, + 'archived' => 0, + 'network_id' => get_current_network_id(), + 'number' => 5, + 'offset' => $n, + 'fields' => 'ids', + 'order' => 'DESC', + 'orderby' => 'id', + 'update_site_meta_cache' => false, ) ); if ( empty( $site_ids ) ) { diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 5652326f56..51ba70de99 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -586,8 +586,9 @@ function get_oembed_response_data_for_url( $url, $args ) { ); $qv = array( - 'domain' => $url_parts['host'], - 'path' => '/', + 'domain' => $url_parts['host'], + 'path' => '/', + 'update_site_meta_cache' => false, ); // In case of subdirectory configs, set the path. diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 259146cdc5..b18ef17e69 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -97,10 +97,11 @@ function get_id_from_blogname( $slug ) { $site_ids = get_sites( array( - 'number' => 1, - 'fields' => 'ids', - 'domain' => $domain, - 'path' => $path, + 'number' => 1, + 'fields' => 'ids', + 'domain' => $domain, + 'path' => $path, + 'update_site_meta_cache' => false, ) ); diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 620e9c9194..76bc35a777 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -345,10 +345,11 @@ function get_blog_id_from_url( $domain, $path = '/' ) { } $args = array( - 'domain' => $domain, - 'path' => $path, - 'fields' => 'ids', - 'number' => 1, + 'domain' => $domain, + 'path' => $path, + 'fields' => 'ids', + 'number' => 1, + 'update_site_meta_cache' => false, ); $result = get_sites( $args ); $id = array_shift( $result ); @@ -1473,11 +1474,12 @@ Disable these notifications: %3$s' function domain_exists( $domain, $path, $network_id = 1 ) { $path = trailingslashit( $path ); $args = array( - 'network_id' => $network_id, - 'domain' => $domain, - 'path' => $path, - 'fields' => 'ids', - 'number' => 1, + 'network_id' => $network_id, + 'domain' => $domain, + 'path' => $path, + 'fields' => 'ids', + 'number' => 1, + 'update_site_meta_cache' => false, ); $result = get_sites( $args ); $result = array_shift( $result ); @@ -2433,11 +2435,12 @@ function wp_update_network_site_counts( $network_id = null ) { $count = get_sites( array( - 'network_id' => $network_id, - 'spam' => 0, - 'deleted' => 0, - 'archived' => 0, - 'count' => true, + 'network_id' => $network_id, + 'spam' => 0, + 'deleted' => 0, + 'archived' => 0, + 'count' => true, + 'update_site_meta_cache' => false, ) ); diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php index 91c9c8c301..3133d2473c 100644 --- a/wp-includes/ms-load.php +++ b/wp-includes/ms-load.php @@ -235,7 +235,8 @@ function get_site_by_path( $domain, $path, $segments = null ) { } $args = array( - 'number' => 1, + 'number' => 1, + 'update_site_meta_cache' => false, ); if ( count( $domains ) > 1 ) { diff --git a/wp-includes/user.php b/wp-includes/user.php index 064f5144f3..dc424f9c0a 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -680,8 +680,9 @@ function get_blogs_of_user( $user_id, $all = false ) { if ( ! empty( $site_ids ) ) { $args = array( - 'number' => '', - 'site__in' => $site_ids, + 'number' => '', + 'site__in' => $site_ids, + 'update_site_meta_cache' => false, ); if ( ! $all ) { $args['archived'] = 0;