WordPress.org

Make WordPress Core

Changeset 40612


Ignore:
Timestamp:
05/10/2017 11:21:43 PM (2 years ago)
Author:
flixos90
Message:

Multisite: Adjust site count of the correct network after having created a new site.

Prior to this change, after creating a site, the network site count was always refreshed on the current network, regardless of whether the site was created on a different network. With the recent changes, particularly [40591], it is now possible to update the site count for a specific $network_id, so this changeset makes use of the new parameter.

Fixes #38699.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r40595 r40612  
    13761376    refresh_blog_details( $blog_id );
    13771377
    1378     wp_maybe_update_network_site_counts();
     1378    wp_maybe_update_network_site_counts( $site_id );
    13791379
    13801380    return $blog_id;
  • trunk/tests/phpunit/tests/multisite/network.php

    r40611 r40612  
    586586        return $is_large_network;
    587587    }
     588
     589    /**
     590     * @ticket 38699
     591     */
     592    public function test_wpmu_create_blog_updates_correct_network_site_count() {
     593        $original_count = get_blog_count( self::$different_network_id );
     594
     595        $site_id = self::factory()->blog->create( array(
     596            'domain'  => 'example.org',
     597            'path'    => '/',
     598            'site_id' => self::$different_network_id,
     599        ) );
     600
     601        $result = get_blog_count( self::$different_network_id );
     602
     603        wpmu_delete_blog( $site_id, true );
     604
     605        $this->assertEquals( $original_count + 1, $result );
     606    }
    588607}
    589608
Note: See TracChangeset for help on using the changeset viewer.