Ticket #22917: right-now-live.diff

File right-now-live.diff, 2.3 KB (added by adamsilverstein, 5 months ago)
  • wp-includes/ms-functions.php

     
    921921        delete_user_option( $user_id, 'user_level' ); 
    922922 
    923923        do_action( 'wpmu_new_user', $user_id ); 
     924        wp_update_network_user_counts(); //user added, update network counts 
    924925 
    925926        return $user_id; 
    926927} 
     
    11491150        populate_options(); 
    11501151        populate_roles(); 
    11511152        $wp_roles->_init(); 
     1153        wp_update_network_blog_counts(); //new blog added, update network counts 
    11521154 
    11531155        $url = untrailingslashit( $url ); 
    11541156 
     
    19231925 *  @since 3.1.0 
    19241926 */ 
    19251927function wp_update_network_counts() { 
     1928        wp_update_network_user_counts(); 
     1929        wp_update_network_blog_counts(); 
     1930} 
     1931 
     1932/** 
     1933 * Update the network-wide counts for users 
     1934 * 
     1935 * @since 3.5.2 
     1936 * 
     1937 */ 
     1938function wp_update_network_user_counts() { 
    19261939        global $wpdb; 
    19271940 
    1928         $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) ); 
    1929         update_site_option( 'blog_count', $count ); 
    1930  
    19311941        $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" ); 
    19321942        update_site_option( 'user_count', $count ); 
    19331943} 
    19341944 
    19351945/** 
     1946 * Update the network-wide counts for blogs 
     1947 * 
     1948 * @since 3.5.2 
     1949 * 
     1950 */ 
     1951function wp_update_network_blog_counts() { 
     1952        global $wpdb; 
     1953 
     1954        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) ); 
     1955        update_site_option( 'blog_count', $count ); 
     1956} 
     1957 
     1958/** 
    19361959 * Returns the space used by the current blog. 
    19371960 * 
    19381961 * @since 3.5.0 
  • wp-admin/includes/ms.php

     
    122122                } 
    123123 
    124124                clean_blog_cache( $blog ); 
     125                wp_update_network_blog_counts(); //blog deleted, update network counts 
     126 
    125127        } 
    126128 
    127129        if ( $switch ) 
     
    168170        $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); 
    169171 
    170172        clean_user_cache( $user ); 
     173        wp_update_network_user_counts(); //user deleted, update network counts 
    171174 
    172175        // allow for commit transaction 
    173176        do_action( 'deleted_user', $id );