Skip to content

Commit

Permalink
Multisite: Support the $network_id parameter of get_blog_count().
Browse files Browse the repository at this point in the history
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.

Built from https://develop.svn.wordpress.org/trunk@40370


git-svn-id: http://core.svn.wordpress.org/trunk@40277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
Felix Arntz committed Apr 5, 2017
1 parent e1a08e1 commit 924e315
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions wp-includes/ms-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,14 @@ function get_user_count() {
* The count is cached and updated twice daily. This is not a live count.
*
* @since MU 1.0
* @since 3.7.0 The $network_id parameter has been deprecated.
* @since 4.8.0 The $network_id parameter is now being used.
*
* @param int $network_id Deprecated, not supported.
* @return int
* @param int|null $network_id ID of the network. Default is the current network.
* @return int Number of active sites on the network.
*/
function get_blog_count( $network_id = 0 ) {
if ( func_num_args() )
_deprecated_argument( __FUNCTION__, '3.1.0' );

return get_site_option( 'blog_count' );
function get_blog_count( $network_id = null ) {
return get_network_option( $network_id, 'blog_count' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40368';
$wp_version = '4.8-alpha-40370';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 924e315

Please sign in to comment.