Skip to:
Content

BuddyPress.org

Opened 4 months ago

Last modified 5 weeks ago

#8141 new defect (bug)

bp_invitations table not created on update

Reported by: shanebp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.0.0
Component: Groups Keywords:
Cc: shanebp

Description

BP 5.0.0 WP 5.2.3
localhost using VVV
I can create db tables from plugins without any issues.
I've toggled activation a few times.

Entry added to debug log on every page load:
[07-Oct-2019 22:35:34 UTC] WordPress database error Table 'wordpress_default.wp_bp_invitations' doesn't exist for query 
SELECT DISTINCT i.item_id FROM wp_bp_invitations i WHERE user_id IN (1) AND class IN ('bp_groups_invitation_manager') 
AND type = 'invite' AND invite_sent = 1 AND accepted = 0   made by require('wp-blog-header.php'), 
require_once('wp-includes/template-loader.php'), include('/themes/twentynineteen/page.php'), 
get_footer, locate_template, load_template, require_once('/themes/twentynineteen/footer.php'), wp_footer, do_action('wp_footer'), 
WP_Hook->do_action, WP_Hook->apply_filters, wp_admin_bar_render, do_action_ref_array('admin_bar_menu'), 
WP_Hook->do_action, WP_Hook->apply_filters, bp_setup_admin_bar, do_action('bp_setup_admin_bar'), 
WP_Hook->do_action, WP_Hook->apply_filters, BP_Groups_Component->setup_admin_bar, 
groups_get_invite_count_for_user, groups_get_invited_to_group_ids, groups_get_invites, 
BP_Invitation_Manager->get_invitations, BP_Invitation::get, QM_DB->query

Change History (15)

#1 @shanebp
4 months ago

  • Cc shanebp added
  • Version set to 5.0.0

#2 @dcavins
3 months ago

Hi @shanebp-

You do have to visit the WP-admin area after updating to cause the update routine to run. I just updated a bunch of sites today, and the invitations routine runs when you load a page in wp-admin after completing the actual update. (I loaded the "dashboard" page and it ran successfully every time for me.)

I'd rather it ran "at update" because you can update plugins from the plugins list, but this follows the BP pattern we've used in the past. I wonder if we can be slicker in the future?

Can you check that the invitations routine runs when you visit the dashboard?

#3 @shanebp
3 months ago

Yes, the error above is from loading any screen in wp-admin.

Here is an example of a front-end error:

[08-Oct-2019 00:44:51 UTC] WordPress database error Table 'wordpress_default.wp_bp_invitations' doesn't exist for query SELECT DISTINCT i.item_id FROM wp_bp_invitations i WHERE user_id IN (1) AND class IN ('bp_groups_invitation_manager') AND type = 'invite' AND invite_sent = 1 AND accepted = 0   made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentynineteen/page.php'), get_footer, locate_template, load_template, require_once('/themes/twentynineteen/footer.php'), wp_footer, do_action('wp_footer'), WP_Hook->do_action, WP_Hook->apply_filters, wp_admin_bar_render, do_action_ref_array('admin_bar_menu'), WP_Hook->do_action, WP_Hook->apply_filters, bp_setup_admin_bar, do_action('bp_setup_admin_bar'), WP_Hook->do_action, WP_Hook->apply_filters, BP_Groups_Component->setup_admin_bar, groups_get_invite_count_for_user, groups_get_invited_to_group_ids, groups_get_invites, BP_Invitation_Manager->get_invitations, BP_Invitation::get, QM_DB->query

btw - I have WP_AUTO_UPDATE_CORE set to false.

#4 @dcavins
3 months ago

What is your _bp_db_version in your wp_options table?

#5 @shanebp
3 months ago


What is your _bp_db_version in your wp_options table?

13731

#6 @dcavins
3 months ago

Huh, well, then bp_update_to_5_0() should have already run. Can you check that the other task in that function ran? (bp_xprofile_meta should be 'allow_custom_visibility' => 'disabled' for the "fullname" xprofile field-though it may have already been that way, so this is not a 100% check.)

Can you look back in your logs for any problems with bp_core_install_invitations() which would have relied on $GLOBALS['wpdb']->get_charset_collate(), bp_core_get_table_prefix() and dbDelta() (if that helps with looking in the logs for issues).

If you don't see any clues in the logs, you can manually set the _bp_db_version back to something less than 12385, and deactivate/reactivate to see if you can see any new errors from bp_update_to_5_0().

I wonder if anyone remembers any problems like what you're seeing with 2.5 and the introduction of the new email system.

#7 @shanebp
3 months ago

There is no fullname xprofile field field on my test install..

I wipe my local logs often to make them easier to handle.

I manually set the _bp_db_version to 12384
Then did an activation toggle.
And _bp_db_version changed to 12385
And the _bp_invitations table was created and the error is gone.

#8 @dcavins
3 months ago

Is there also now an entry in the wp_bp_xprofile_meta table that looks like this:

id  object_id  object_type  meta_key                 meta_value
1   1          field        allow_custom_visibility  disabled

I'm trying to understand whether the entire update routine failed to run, or if just the invitations part originally failed. Do you have an opinion about what went wrong previously?

Thanks for your help troubleshooting!

Last edited 3 months ago by dcavins (previous) (diff)

#9 @shanebp
3 months ago

Is there also now an entry in the wp_bp_xprofile_meta table that looks like this:

Yes. For the name field.

I don't have an opinion.
I have encountered edge cases where db operations failed when called as part of a plugin update.
Usually those cases are solved by toggling activation and visiting a wp-admin page.
Not much help, but I've found that these procedures can be squirrelly when distributed.

#10 @sjregan
6 weeks ago

I had the same issue, the invitations table was not created during an upgrade from v4.4.0 to v5.1.0.

Once the upgrade was complete a fatal error was thrown within BP because a function was already previously declared in another plugin.

While the other plugin was at fault for incorrectly defining a function with the same name as a BP function, it demonstrates a scenario where a faulty plugin can cause the BP upgrade to fail in a way where the invitations table is not created.

#11 @sjregan
6 weeks ago

Additionally I now have two entries in my wp_bp_xprofile_meta table where object_id = 1, object_type = field, meta_key = allow_custom_visibility, meta_value = disabled.

(This was after manually changing the DB version to 12384 and deactivating/reactivating the plugin)

Last edited 6 weeks ago by sjregan (previous) (diff)

#12 @needle
5 weeks ago

Just encountered the same missing table problem. Plugin updated via git from the BuddyPress GitHub repo -- unfortunately I can't confirm previous version. I also have the duplicate entry in wp_bp_xprofile_meta like @sjregan when deactivating/reactivating after downgrading the DB version to 12384.

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


5 weeks ago

#14 @dcavins
5 weeks ago

Thanks for your comments on this issue. It's sounding to me like the "install at upgrade" routine we've used in the past is not entirely reliable.

If there had been a tool to fix these problems at WP Admin > Tools > BuddyPress, would you have known to use them? Or, would that have been sufficient?

Thanks again for your feedback and troubleshooting help.

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


5 weeks ago

Note: See TracTickets for help on using tickets.