WordPress.org

Make WordPress Core

Ticket #40489: 40489.diff

File 40489.diff, 2.0 KB (added by flixos90, 13 months ago)
  • src/wp-includes/ms-functions.php

     
    24802480 * Plugins can alter this criteria using the {@see 'wp_is_large_network'} filter.
    24812481 *
    24822482 * @since 3.3.0
    2483  * @param string $using 'sites or 'users'. Default is 'sites'.
     2483 * @since 4.8.0 The $network_id parameter has been added.
     2484 *
     2485 * @param string   $using      'sites or 'users'. Default is 'sites'.
     2486 * @param int|null $network_id ID of the network. Default is the current network.
    24842487 * @return bool True if the network meets the criteria for large. False otherwise.
    24852488 */
    2486 function wp_is_large_network( $using = 'sites' ) {
     2489function wp_is_large_network( $using = 'sites', $network_id = null ) {
     2490        $network_id = (int) $network_id;
     2491        if ( ! $network_id ) {
     2492                $network_id = get_current_network_id();
     2493        }
     2494
    24872495        if ( 'users' == $using ) {
    2488                 $count = get_user_count();
     2496                $count = get_user_count( $network_id );
    24892497                /**
    24902498                 * Filters whether the network is considered large.
    24912499                 *
    24922500                 * @since 3.3.0
     2501                 * @since 4.8.0 The $network_id parameter has been added.
    24932502                 *
    24942503                 * @param bool   $is_large_network Whether the network has more than 10000 users or sites.
    24952504                 * @param string $component        The component to count. Accepts 'users', or 'sites'.
    24962505                 * @param int    $count            The count of items for the component.
     2506                 * @param int    $network_id       The ID of the network being checked.
    24972507                 */
    2498                 return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
     2508                return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count, $network_id );
    24992509        }
    25002510
    2501         $count = get_blog_count();
     2511        $count = get_blog_count( $network_id );
    25022512        /** This filter is documented in wp-includes/ms-functions.php */
    2503         return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
     2513        return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count, $network_id );
    25042514}
    25052515
    25062516/**