Multisite: Count users in a more performant way when listing sites in the network admin.
Props spacedmonkey. Fixes #44368. Built from https://develop.svn.wordpress.org/trunk@43382 git-svn-id: http://core.svn.wordpress.org/trunk@43210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e350e822f8
commit
76c25aa14b
|
@ -406,14 +406,13 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
public function column_users( $blog ) {
|
||||
$user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' );
|
||||
if ( ! $user_count ) {
|
||||
$blog_users = get_users(
|
||||
array(
|
||||
'blog_id' => $blog['blog_id'],
|
||||
'fields' => 'ID',
|
||||
)
|
||||
);
|
||||
$user_count = count( $blog_users );
|
||||
unset( $blog_users );
|
||||
$blog_users = new WP_User_Query( array(
|
||||
'blog_id' => $blog['blog_id'],
|
||||
'fields' => 'ID',
|
||||
'number' => 1,
|
||||
'count_total' => true,
|
||||
) );
|
||||
$user_count = $blog_users->get_total();
|
||||
wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-alpha-43381';
|
||||
$wp_version = '5.0-alpha-43382';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue