WordPress.org

Make WordPress Core

Ticket #37528: 37528.2.patch

File 37528.2.patch, 964 bytes (added by johnjamesjacoby, 2 years ago)

Refresh. Coding standards, and use update_network_option() so $count gets saved on the correct network

  • src/wp-includes/ms-functions.php

    diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
    index 3eb7f67..cfb78f5 100644
     
    22892289 *
    22902290 * @since 3.7.0
    22912291 *
    2292  * @global wpdb $wpdb WordPress database abstraction object.
     2292 * @param int $network_id Optional. Id of the network to calculate the site count for. Defaults to active network id.
    22932293 */
    2294 function wp_update_network_site_counts() {
    2295         global $wpdb;
     2294function wp_update_network_site_counts( $network_id = null ) {
     2295
     2296        $network_id = (int) $network_id;
     2297        if ( ! $network_id ) {
     2298                $network_id = get_current_network_id();
     2299        }
    22962300
    22972301        $count = get_sites( array(
    2298                 'network_id' => $wpdb->siteid,
     2302                'network_id' => $network_id,
    22992303                'spam'       => 0,
    23002304                'deleted'    => 0,
    23012305                'archived'   => 0,
    23022306                'count'      => true,
    23032307        ) );
    23042308
    2305         update_site_option( 'blog_count', $count );
     2309        update_network_option( $network_id, 'blog_count', $count );
    23062310}
    23072311
    23082312/**