Multisite: Do not prime site meta caches unless necessary.

Props spacedmonkey.
Fixes #46357. See #46167.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2019-03-18 15:56:51 +00:00
parent 0607371f84
commit 97d33e5231
7 changed files with 41 additions and 33 deletions

View File

@ -57,15 +57,16 @@ switch ( $action ) {
$site_ids = get_sites( $site_ids = get_sites(
array( array(
'spam' => 0, 'spam' => 0,
'deleted' => 0, 'deleted' => 0,
'archived' => 0, 'archived' => 0,
'network_id' => get_current_network_id(), 'network_id' => get_current_network_id(),
'number' => 5, 'number' => 5,
'offset' => $n, 'offset' => $n,
'fields' => 'ids', 'fields' => 'ids',
'order' => 'DESC', 'order' => 'DESC',
'orderby' => 'id', 'orderby' => 'id',
'update_site_meta_cache' => false,
) )
); );
if ( empty( $site_ids ) ) { if ( empty( $site_ids ) ) {

View File

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

View File

@ -97,10 +97,11 @@ function get_id_from_blogname( $slug ) {
$site_ids = get_sites( $site_ids = get_sites(
array( array(
'number' => 1, 'number' => 1,
'fields' => 'ids', 'fields' => 'ids',
'domain' => $domain, 'domain' => $domain,
'path' => $path, 'path' => $path,
'update_site_meta_cache' => false,
) )
); );

View File

@ -345,10 +345,11 @@ function get_blog_id_from_url( $domain, $path = '/' ) {
} }
$args = array( $args = array(
'domain' => $domain, 'domain' => $domain,
'path' => $path, 'path' => $path,
'fields' => 'ids', 'fields' => 'ids',
'number' => 1, 'number' => 1,
'update_site_meta_cache' => false,
); );
$result = get_sites( $args ); $result = get_sites( $args );
$id = array_shift( $result ); $id = array_shift( $result );
@ -1473,11 +1474,12 @@ Disable these notifications: %3$s'
function domain_exists( $domain, $path, $network_id = 1 ) { function domain_exists( $domain, $path, $network_id = 1 ) {
$path = trailingslashit( $path ); $path = trailingslashit( $path );
$args = array( $args = array(
'network_id' => $network_id, 'network_id' => $network_id,
'domain' => $domain, 'domain' => $domain,
'path' => $path, 'path' => $path,
'fields' => 'ids', 'fields' => 'ids',
'number' => 1, 'number' => 1,
'update_site_meta_cache' => false,
); );
$result = get_sites( $args ); $result = get_sites( $args );
$result = array_shift( $result ); $result = array_shift( $result );
@ -2433,11 +2435,12 @@ function wp_update_network_site_counts( $network_id = null ) {
$count = get_sites( $count = get_sites(
array( array(
'network_id' => $network_id, 'network_id' => $network_id,
'spam' => 0, 'spam' => 0,
'deleted' => 0, 'deleted' => 0,
'archived' => 0, 'archived' => 0,
'count' => true, 'count' => true,
'update_site_meta_cache' => false,
) )
); );

View File

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

View File

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

View File

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