[buddypress-trac] [BuddyPress Trac] #6940: fatal error: bp_blogs_record_existing_blogs

buddypress-trac noreply at wordpress.org
Fri Mar 11 05:37:06 UTC 2016


#6940: fatal error:  bp_blogs_record_existing_blogs
------------------------------+-----------------------
 Reporter:  shanebp           |       Owner:
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:
Component:  Component - Core  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |
------------------------------+-----------------------
Changes (by r-a-y):

 * keywords:   => has-patch
 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 I came across a similar problem today with
 `bp_blogs_record_existing_blogs()`.

 The site in question is a single-site install with a rather large
 userbase.

 The problem occurred when the site admin used the "`Repopulate blog
 records`" option on the "`Tools > BuddyPress`" page.

 This calls `bp_blogs_record_existing_blogs()`, which wipes out the
 `wp_bp_user_blogs` table and attempts to repopulate the blog records.

 On this install, the table is truncated, but the blog records are never
 repopulated because the `get_users()` call fails with a WSOD.  (This is
 due to the size of the userbase.)

 Now, here is the interesting part.  BuddyPress tries to repopulate the
 blog records whenever the admin dashboard is loaded via
 `bp_core_activation_notice()` of all places!

 So the admin dashboard always gets a WSOD.

 The problem here is two-fold; `bp_blogs_record_existing_blogs()` is not a
 very well-coded function when used on large sites.

 There are two ways to fix this:
 1. Do not attempt to record existing users to the `wp_bp_user_blogs` table
 on a single-site install as it doesn't make much sense.
 2. Modify bp_blogs_record_existing_blogs() to check the user count on a
 single site install and use a check similar to `wp_is_large_network(
 'users' )`.  If the install is large, bail.

 I would go with patch 1.

 For other improvements to `bp_blogs_record_existing_blogs()`, also see
 #6370.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6940#comment:6>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list