diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
index 3eb7f67..cfb78f5 100644
--- src/wp-includes/ms-functions.php
+++ src/wp-includes/ms-functions.php
@@ -2289,20 +2289,24 @@
  *
  * @since 3.7.0
  *
- * @global wpdb $wpdb WordPress database abstraction object.
+ * @param int $network_id Optional. Id of the network to calculate the site count for. Defaults to active network id.
  */
-function wp_update_network_site_counts() {
-	global $wpdb;
+function wp_update_network_site_counts( $network_id = null ) {
+
+	$network_id = (int) $network_id;
+	if ( ! $network_id ) {
+		$network_id = get_current_network_id();
+	}
 
 	$count = get_sites( array(
-		'network_id' => $wpdb->siteid,
+		'network_id' => $network_id,
 		'spam'       => 0,
 		'deleted'    => 0,
 		'archived'   => 0,
 		'count'      => true,
 	) );
 
-	update_site_option( 'blog_count', $count );
+	update_network_option( $network_id, 'blog_count', $count );
 }
 
 /**
