Ticket #40349: 40349.diff
File 40349.diff, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/ms-functions.php
2346 2346 * Update the network-wide user count. 2347 2347 * 2348 2348 * @since 3.7.0 2349 * @since 4.8.0 The $network_id parameter has been added. 2349 2350 * 2350 2351 * @global wpdb $wpdb WordPress database abstraction object. 2352 * 2353 * @param int|null $network_id ID of the network. Default is the current network. 2351 2354 */ 2352 function wp_update_network_user_counts( ) {2355 function wp_update_network_user_counts( $network_id = null ) { 2353 2356 global $wpdb; 2354 2357 2355 2358 $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" ); 2356 update_ site_option('user_count', $count );2359 update_network_option( $network_id, 'user_count', $count ); 2357 2360 } 2358 2361 2359 2362 /** -
tests/phpunit/tests/multisite/network.php
235 235 } 236 236 237 237 /** 238 * @ticket 40349 239 */ 240 public function test_wp_update_network_user_counts_on_different_network() { 241 wp_update_network_user_counts(); 242 $expected = get_user_count(); 243 244 wp_update_network_user_counts( self::$different_network_id ); 245 $actual = get_user_count( self::$different_network_id ); 246 247 $this->assertEquals( $expected, $actual ); 248 } 249 250 /** 238 251 * @ticket 22917 239 252 */ 240 253 function test_enable_live_network_user_counts_filter() {