[buddypress-trac] [BuddyPress Trac] #8149: Incorrect 'ids' param passed to `groups_get_invites()` causes all invites to be returned
buddypress-trac
noreply at wordpress.org
Tue Oct 22 19:09:33 UTC 2019
#8149: Incorrect 'ids' param passed to `groups_get_invites()` causes all invites
to be returned
--------------------------+--------------------
Reporter: boonebgorges | Owner: (none)
Type: defect (bug) | Status: new
Priority: highest | Milestone: 5.1.0
Component: Groups | Version: 5.0.0
Severity: critical | Keywords:
--------------------------+--------------------
After an upgrade to 5.0, I noticed a severe slowdown on a site with a
fairly large number of invitations. After some tracing, I found the
following:
- `groups_get_user_groups()`, which is called in many ways throughout BP -
including `groups_is_user_member()`, etc - tries to cache uncached
invitation objects
- In the case of my installation (running a Memcached backend) the
invitation objects are all being stored in the cache. As a result,
`$uncached_invitation_ids` is empty
https://buddypress.trac.wordpress.org/browser/tags/5.0.0/src/bp-groups/bp-
groups-functions.php?marks=982#L971
- This array is being passed as the `ids` param to `groups_get_invites()`
https://buddypress.trac.wordpress.org/browser/tags/5.0.0/src/bp-groups/bp-
groups-functions.php?marks=985#L971
- But `groups_get_invites()` doesn't appear to accept an `ids` param
The result is that, on sites running an object cache, every call to
`groups_get_invites()` is triggering every single invite to be fetched
from the database. This can be crippling in certain circumstances.
I think that the general fix should be to change the `ids` param to `id`
on line 985 linked above. Alternatively (or in addition?) when
`$uncached_invitation_ids` is empty, there's no reason to even make the
call to `groups_get_invites()` in the first place.
@dcavins Could you please have a look at the above and let me know what
you think?
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8149>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list