WordPress.org

Make WordPress Core

Ticket #40736: php33xaUA

File php33xaUA, 1.6 KB (added by pmbaldha, 4 years ago)

Deprecated get_blog_count() function and developed get_site_count function

Line 
1Index: src/wp-includes/ms-functions.php
2===================================================================
3--- src/wp-includes/ms-functions.php    (revision 40848)
4+++ src/wp-includes/ms-functions.php    (working copy)
5@@ -102,7 +102,7 @@
6  * @return int Number of active users on the network.
7  */
8 function get_user_count( $network_id = null ) {
9-       return get_network_option( $network_id, 'user_count' );
10+       return intval( get_network_option( $network_id, 'user_count' ) );
11 }
12 
13 /**
14@@ -111,6 +111,10 @@
15  * The count is cached and updated twice daily. This is not a live count.
16  *
17  * @since MU 1.0
18+ *
19+ * @deprecated 4.8 Use get_site_count()
20+ * @see get_site_count()
21+ *
22  * @since 3.7.0 The $network_id parameter has been deprecated.
23  * @since 4.8.0 The $network_id parameter is now being used.
24  *
25@@ -118,10 +122,25 @@
26  * @return int Number of active sites on the network.
27  */
28 function get_blog_count( $network_id = null ) {
29-       return get_network_option( $network_id, 'blog_count' );
30+       _deprecated_function( __FUNCTION__, '4.8', 'get_site_count()' );
31+       return get_site_count( $network_id  );
32 }
33 
34 /**
35+ * The number of active sites on your installation.
36+ *
37+ * The count is cached and updated twice daily. This is not a live count.
38+ *
39+ * @since MU 4.8
40+ *
41+ * @param int|null $network_id ID of the network. Default is the current network.
42+ * @return int Number of active sites on the network.
43+ */
44+function get_site_count( $network_id = null ) {
45+       return intval( get_network_option( $network_id, 'blog_count' ) );
46+}
47+
48+/**
49  * Get a blog post from any site on the network.
50  *
51  * @since MU 1.0