Ticket #40386: 40386.diff
File 40386.diff, 2.0 KB (added by , 7 years ago) |
---|
-
src/wp-includes/ms-functions.php
2274 2274 * Update the network-wide counts for the current network. 2275 2275 * 2276 2276 * @since 3.1.0 2277 * @since 4.8.0 The $network_id parameter has been added. 2278 * 2279 * @param int|null $network_id ID of the network. Default is the current network. 2277 2280 */ 2278 function wp_update_network_counts( ) {2279 wp_update_network_user_counts( );2280 wp_update_network_site_counts( );2281 function wp_update_network_counts( $network_id = null ) { 2282 wp_update_network_user_counts( $network_id ); 2283 wp_update_network_site_counts( $network_id ); 2281 2284 } 2282 2285 2283 2286 /** -
tests/phpunit/tests/multisite/network.php
440 440 $result = get_user_count( self::$different_network_id ); 441 441 $this->assertEquals( $expected, $result ); 442 442 } 443 444 /** 445 * @ticket 40386 446 */ 447 public function test_wp_update_network_counts() { 448 delete_network_option( null, 'site_count' ); 449 delete_network_option( null, 'user_count' ); 450 451 wp_update_network_counts(); 452 453 $site_count = (int) get_blog_count(); 454 $user_count = (int) get_user_count(); 455 456 $this->assertTrue( $site_count > 0 && $user_count > 0 ); 457 } 458 459 /** 460 * @ticket 40386 461 */ 462 public function test_wp_update_network_counts_on_different_network() { 463 delete_network_option( self::$different_network_id, 'site_count' ); 464 delete_network_option( self::$different_network_id, 'user_count' ); 465 466 wp_update_network_counts( self::$different_network_id ); 467 468 $site_count = (int) get_blog_count( self::$different_network_id ); 469 $user_count = (int) get_user_count( self::$different_network_id ); 470 471 $this->assertTrue( $site_count > 0 && $user_count > 0 ); 472 } 443 473 } 444 474 445 475 endif;