WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/27/2017 01:03:03 PM (3 years ago)
Author:
johnbillion
Message:

Users: Introduce the concept of a large site in order to speed up the Users screen when there are many users.

Calling the count_users() function is expensive, regardless of the counting strategy that's used, and it gets
slower the more users there are on a site. In order to speed up the Users screen in the admin area, calling
count_users() can be avoided entirely while still displaying the total count for users.

This introduces some new functions:

  • wp_is_large_user_count()
  • wp_get_active_user_count()
  • wp_update_active_user_count()

A corresponding wp_is_large_user_count filter is also introduced.

Props tharsheblows, johnbillion

Fixes #38741

File:
1 edited

Legend:

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

    r41605 r41613  
    7979        $multisite_enabled = 1;
    8080    } else {
    81         $user_count = count_users();
    82         $user_count = $user_count['total_users'];
     81        $user_count = wp_get_active_user_count();
    8382        $multisite_enabled = 0;
    8483        $num_blogs = 1;
Note: See TracChangeset for help on using the changeset viewer.