Ticket #22917: 22917.4.diff
File 22917.4.diff, 2.9 KB (added by , 12 years ago) |
---|
-
wp-includes/ms-functions.php
905 905 delete_user_option( $user_id, 'user_level' ); 906 906 907 907 do_action( 'wpmu_new_user', $user_id ); 908 if ( apply_filters( 'enable_live_network_user_counts', ! wp_is_large_network( 'users' ) ) ) // live update user count, unless large network see trac #22917 909 wp_update_network_user_counts(); // user added, update network counts 908 910 909 911 return $user_id; 910 912 } … … 1134 1136 populate_options(); 1135 1137 populate_roles(); 1136 1138 $wp_roles->_init(); 1139 if ( apply_filters( 'enable_live_network_blog_counts', ! wp_is_large_network( 'sites' ) ) ) // live update blog count, unless large network - see trac #22917 1140 wp_update_network_blog_counts(); // new blog added, update network counts 1137 1141 1138 1142 $url = untrailingslashit( $url ); 1139 1143 … … 1881 1885 * @since 3.1.0 1882 1886 */ 1883 1887 function wp_update_network_counts() { 1888 wp_update_network_user_counts(); 1889 wp_update_network_blog_counts(); 1890 } 1891 1892 /** 1893 * Update the network-wide counts for users. 1894 * 1895 * @since 3.6.0 1896 */ 1897 function wp_update_network_user_counts() { 1884 1898 global $wpdb; 1885 1899 1886 $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) );1887 update_site_option( 'blog_count', $count );1888 1889 1900 $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" ); 1890 1901 update_site_option( 'user_count', $count ); 1891 1902 } 1892 1903 1893 1904 /** 1905 * Update the network-wide counts for blogs. 1906 * 1907 * @since 3.6.0 1908 */ 1909 function wp_update_network_blog_counts() { 1910 global $wpdb; 1911 1912 $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 ) ); 1913 update_site_option( 'blog_count', $count ); 1914 } 1915 1916 /** 1894 1917 * Returns the space used by the current blog. 1895 1918 * 1896 1919 * @since 3.5.0 -
wp-admin/includes/ms.php
122 122 } 123 123 124 124 clean_blog_cache( $blog ); 125 if ( apply_filters( 'enable_live_network_blog_counts', ! wp_is_large_network( 'sites' ) ) ) // live update blog count, unless large network - see trac #22917 126 wp_update_network_blog_counts(); // blog deleted, update network counts 125 127 } 126 128 127 129 if ( $switch ) … … 171 173 $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); 172 174 173 175 clean_user_cache( $user ); 176 if ( apply_filters( 'enable_live_network_user_counts', ! wp_is_large_network( 'users' ) ) ) // live update user count, unless large network see trac #22917 177 wp_update_network_user_counts(); // user deleted, update network counts 174 178 175 179 // allow for commit transaction 176 180 do_action( 'deleted_user', $id );