From 0dc18d3ffbfd073e8aebdea14b8b4ad1375b74d7 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 30 Sep 2016 03:51:30 +0000 Subject: [PATCH] Multisite: Use `get_sites()` in network upgrade. Use `get_sites()` to generate the same query that was previously performed manually. Props spacedmonkey, flixos90. Fixes #37823. Built from https://develop.svn.wordpress.org/trunk@38680 git-svn-id: http://core.svn.wordpress.org/trunk@38623 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/network/upgrade.php | 22 ++++++++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/wp-admin/network/upgrade.php b/wp-admin/network/upgrade.php index f184a8c3e6..b2001e1364 100644 --- a/wp-admin/network/upgrade.php +++ b/wp-admin/network/upgrade.php @@ -52,14 +52,24 @@ switch ( $action ) { update_site_option( 'wpmu_upgrade_site', $wp_db_version ); } - $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY blog_id DESC LIMIT {$n}, 5", ARRAY_A ); - if ( empty( $blogs ) ) { + $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', + ) ); + if ( empty( $site_ids ) ) { echo '

' . __( 'All done!' ) . '

'; break; } echo ""; ?>

diff --git a/wp-includes/version.php b/wp-includes/version.php index 9a64f14d57..fa0682d3fb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38679'; +$wp_version = '4.7-alpha-38680'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.