[wp-trac] [WordPress Trac] #38741: Introduce the concept of a large site in order to speed up the Users screen when there are many users
WordPress Trac
noreply at wordpress.org
Fri Apr 13 14:02:10 UTC 2018
#38741: Introduce the concept of a large site in order to speed up the Users screen
when there are many users
-------------------------+-------------------------------------------------
Reporter: johnbillion | Owner: johnbillion
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.0
Component: Users | Version:
Severity: normal | Resolution:
Keywords: early | Focuses: administration, multisite,
needs-patch | performance
-------------------------+-------------------------------------------------
Comment (by flixos90):
@johnbillion I like the idea of tying in more with the existing multisite
functionality, and I actually prefer the initial name `wp_is_large_site()`
as it would align well with the existing `wp_is_large_network()`. It could
have a parameter defaulting to `users`, which determines what criteria to
use to determine whether the site is considered large. This would make it
future-proof for other similar ideas (maybe `wp_is_large_site( 'posts' )`
could come in handy at some point too.
I don't like the `wp_is_large_user_count()` as it's unclear how that works
(it counts ''all'' users, in multisite that's the entire setup). I also
don't think we should need a separate additional filter to
`wp_is_large_network()` just for that purpose. The new function should be
there for a site. It should be available for a single site, but just as
useful when having multisite enabled.
I propose the following:
* Introduce `wp_is_large_site( $using = 'users', $site_id = null )`. The
second parameter defaults to the current site, but allows to do the check
for another site in multisite.
* The option where the number is stored should be called `user_count`. I
don't see why the 'active' is needed here at all.
* The SQL query to count the users can remain as is for single site
(single all users = site users here), but in multisite it should have a
meta table join and do `WHERE umeta.meta_key = 'wp_X_capabilities'`
(depending on the site checked).
* `wp_update_active_user_count()` should be `wp_update_site_user_counts(
$site_id = null )` instead, to align with `wp_update_network_user_counts(
$network_id = null )`.
* I really like the idea of leveraging `get_user_count()` for sites as
well, however I'm not sure how to sanely do so as it already has a
`$network_id` as first parameter. We could create `get_site_user_count()`
but that'd be kind of incoherent (unless we'd also have
`get_network_user_count()` - but maybe we could consider refactoring
this).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38741#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list