Make WordPress Core


Ignore:
Timestamp:
04/03/2017 11:13:40 PM (8 years ago)
Author:
flixos90
Message:

Multisite: Support the $network_id parameter of get_blog_count().

The get_blog_count() function used to support an $id parameter for the network ID prior to WordPress 3.1. This parameter has not been used since the introduction of get_site_option() and was later deprecated in [25113]. With get_network_option() however it is possible to support the parameter again, now properly renamed as $network_id.

A unit test has for the parameter has been added as well. Another unit test in the same class was adjusted to work properly with multiple networks existing.

Fixes #37865.

File:
1 edited

Legend:

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

    r40295 r40370  
    110110 *
    111111 * @since MU 1.0
    112  *
    113  * @param int $network_id Deprecated, not supported.
    114  * @return int
    115  */
    116 function get_blog_count( $network_id = 0 ) {
    117     if ( func_num_args() )
    118         _deprecated_argument( __FUNCTION__, '3.1.0' );
    119 
    120     return get_site_option( 'blog_count' );
     112 * @since 3.7.0 The $network_id parameter has been deprecated.
     113 * @since 4.8.0 The $network_id parameter is now being used.
     114 *
     115 * @param int|null $network_id ID of the network. Default is the current network.
     116 * @return int Number of active sites on the network.
     117 */
     118function get_blog_count( $network_id = null ) {
     119    return get_network_option( $network_id, 'blog_count' );
    121120}
    122121
Note: See TracChangeset for help on using the changeset viewer.