#15854 closed defect (bug) (fixed)
get_users/WP_User_Query is not scalable
| Reported by: | duck_ | Owned by: | |
|---|---|---|---|
| Priority: | highest omg bbq | Milestone: | 3.1 |
| Component: | General | Version: | 3.1 |
| Severity: | blocker | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description
Use of get_users (and by extension WP_User_Query) is not scalable for sites with a large number of users. Fatal errors occur when caching all the resulting users to memory.
Example usage which causes fatal errors in 3.1 (no fatal error in 3.0.3 for a site with even more users):
- Deleting a user (wp-admin/users.php line 175)
- XML-RPC request for wp.getAuthors (wp-includes/class-wp-xmlrpc-server.php line 783)
- Creating a network (wp-admin/schema.php line 670)
- wp_list_authors (wp-includes/author-template.php line 287)
And probably others, grep for get_users.
Patches for first to examples attached, but I can't help but feel this is just papering over the issue.
Attachments (3)
Change History (19)
#3
@
16 years ago
I guess we should add a 'cache_results' parameter to WP_User_Query and set it to false by default.
#6
@
16 years ago
- Resolution fixed
- Status closed → reopened
This change breaks backwards compat for get_users_of_blog
In 3.0 this joined on the usermeta table and returned and array of stdclass with the caps as a properties too.
It doesn't anymore after this last set of changes.
#7
@
16 years ago
- Keywords has-patch added
In 3.0 this joined on the usermeta table and returned and array of stdclass with the caps as a properties too.
More precisely, it had a 'meta_value' property, which contained the capabilities:
http://core.trac.wordpress.org/browser/tags/3.0.3/wp-includes/user.php#L328
#11
@
16 years ago
deprecating the function and restoring the old direct SQL is lame.
Is there no way to wrap get_users and still return the old data structure?
#12
@
16 years ago
deprecating the function and restoring the old direct SQL is lame.
To that I will reply that get_users_of_blog() is lame. :)
Is there no way to wrap get_users and still return the old data structure?
Only if we loop through each result, serialize back the 'capabilities' property and add it as 'meta_value'.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
(In [17010]) Use wp_dropdown_users() in the delete confirmation screen. Props duck_. See #15854