multisite network admin to delete user attempts to load millions of users into memory
|Reported by:||_ck_||Owned by:||SergeyBiryukov|
There is an unbound mysql query in multisite network admin.
$blog_users = get_users( array( 'blog_id' => $details->userblog_id ) );
around line 53 in wp-admin/network/users.php
If there are millions of users with wp_capabilities, it will attempt to load all of them into memory at once.
Then it attempts to do a one-by-one comparison in a php loop.
This entire section of code needs to be rewritten to simply load the users by id and simply do a LIKE '%\_capabilities' then compare their capabilities against the requested blog ids. Or even better since you know the blog ids and capabilities, just request the specific meta_key ie. wp_123_capabilities which would be way faster because it has an index.
Change History (13)
- Milestone changed from Awaiting Review to 3.7
- Version changed from 3.6 to 3.1
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed