WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/12/2017 01:10:24 PM (3 years ago)
Author:
flixos90
Message:

Multisite: Remove references to $wpdb->siteid and use get_current_network_id() instead.

Props sathyapulse, spacedmonkey.
Fixes #41507.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/network.php

    r40612 r41242  
    190190     */
    191191    public function test_get_blog_count_on_different_network() {
    192         global $current_site, $wpdb;
    193 
    194         // switch_to_network()...
    195         $orig_network_id = $current_site->id;
    196         $orig_wpdb_network_id = $wpdb->siteid;
    197         $current_site->id = self::$different_network_id;
    198         $wpdb->siteid = self::$different_network_id;
    199         wp_update_network_site_counts();
    200         $current_site->id = $orig_network_id;
    201         $wpdb->siteid = $orig_wpdb_network_id;
     192        wp_update_network_site_counts( self::$different_network_id );
    202193
    203194        $site_count = get_blog_count( self::$different_network_id );
     
    210201     */
    211202    public function test_get_user_count_on_different_network() {
    212         global $current_site, $wpdb;
    213 
    214203        wp_update_network_user_counts();
    215204        $current_network_user_count = get_user_count();
    216205
    217         // switch_to_network()...
    218         $orig_network_id = $current_site->id;
    219         $orig_wpdb_network_id = $wpdb->siteid;
    220         $current_site->id = self::$different_network_id;
    221         $wpdb->siteid = self::$different_network_id;
    222 
    223206        // Add another user to fake the network user count to be different.
    224207        wpmu_create_user( 'user', 'pass', 'email' );
    225208
    226         wp_update_network_user_counts();
    227 
    228         // restore_current_network()...
    229         $current_site->id = $orig_network_id;
    230         $wpdb->siteid = $orig_wpdb_network_id;
     209        wp_update_network_user_counts( self::$different_network_id );
    231210
    232211        $user_count = get_user_count( self::$different_network_id );
Note: See TracChangeset for help on using the changeset viewer.