mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 22:24:36 +00:00
Users: Introduce the concept of a large site to single site installations.
Currently in WordPress multisite there is a concept of large networks. The function `wp_is_large_network` is used to determine if a network has a large number of sites or users. If a network is marked as large, then expensive queries to calculate user counts are not run on page load but deferred to scheduled events. However there are a number of places in a single site installation where this functionality would also be useful, as expensive calls to count users and roles can make screens in the admin extremely slow. In this change, the `get_user_count` function and related functionality around it is ported to be available in a single site context. This means that expensive calls to the `count_users` function are replaced with calls to `get_user_count`. This change also includes a new function called `wp_is_large_user_count` and a filter of the same name, to mark if a site is large. Props johnbillion, Spacedmonkey, Mista-Flo, lumpysimon, tharsheblows, obenland, miss_jwo, jrchamp, flixos90, macbookandrew, pento, desrosj, johnjamesjacoby, jb510, davidbaumwald, costdev. Fixes #38741. git-svn-id: https://develop.svn.wordpress.org/trunk@53011 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -388,11 +388,6 @@ class WP_Debug_Data {
|
||||
$site_count += get_blog_count( $network_id );
|
||||
}
|
||||
|
||||
$info['wp-core']['fields']['user_count'] = array(
|
||||
'label' => __( 'User count' ),
|
||||
'value' => get_user_count(),
|
||||
);
|
||||
|
||||
$info['wp-core']['fields']['site_count'] = array(
|
||||
'label' => __( 'Site count' ),
|
||||
'value' => $site_count,
|
||||
@@ -402,15 +397,13 @@ class WP_Debug_Data {
|
||||
'label' => __( 'Network count' ),
|
||||
'value' => $network_query->found_networks,
|
||||
);
|
||||
} else {
|
||||
$user_count = count_users();
|
||||
|
||||
$info['wp-core']['fields']['user_count'] = array(
|
||||
'label' => __( 'User count' ),
|
||||
'value' => $user_count['total_users'],
|
||||
);
|
||||
}
|
||||
|
||||
$info['wp-core']['fields']['user_count'] = array(
|
||||
'label' => __( 'User count' ),
|
||||
'value' => get_user_count(),
|
||||
);
|
||||
|
||||
// WordPress features requiring processing.
|
||||
$wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user