fix: Multisite table names, dbDelta schemas, and migration guards - #2953
Open
mwenell wants to merge 1 commit into
Open
fix: Multisite table names, dbDelta schemas, and migration guards#2953mwenell wants to merge 1 commit into
mwenell wants to merge 1 commit into
Conversation
Resolve incorrect global users/usermeta prefixing on Multisite subsites, make create_database() dbDelta-compatible, skip cart templates during REST, and prevent migration cron fatals when Tutor tables are missing per blog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves WordPress Multisite support for Tutor LMS 4.0.4. It fixes incorrect global table prefixing (
users/usermeta), dbDelta schema issues on network activation, Site Editor REST errors when cart tables are missing, and migration cron fatals on subsites without Tutor tables.I have made this fix because Tutor LMS was crashing when Wordpress was makingg API calls related to user specific patterns in Gutenberg editor (templates). With these fixes I can use the Tutor LMS in my multisite Wordpress. However, I have not tested everything, only my own things are now working fine.
I hope that you could add these updates in your next update -> I do not need to keep updateing by myself my own multisite version.
I have posted in Wordpress plugin forum (Tutor) at https://wordpress.org/support/topic/multisite-support-has-bugs/
This changes are done by using Cursor and AI.
Problems addressed
QueryHelper::prepare_table_name()produced invalid names likewp_7_usermetaandwp_7_wp_usersinstead ofwp_users/wp_usermeta.--comments, TEXT defaults, FOREIGN KEYs with database-global constraint names on Multisite).the_contenttriggered cart/checkout DB queries on blogs without ecommerce tables.quiz_attempt_migratorfatals whenwp_N_tutor_quiz_attemptsdoes not exist on network-activated subsites.Approach
Centralized fix in
QueryHelper::prepare_table_name()plus minimal related call sites. No fake per-blogusers/usermetatables. Single-site behavior intended unchanged.Documentation
See
UPSTREAM_FIXES.mdin this PR for root cause, file list, and verification steps.Test plan
wp_N_users,wp_N_usermeta,wp_N_wp_usersTutor::create_database()on a subsite without duplicate FK / empty KEY errorstutor_cartsfatalsquiz_attempt_migratorcron on blog without Tutor tables does not fatalEnvironment
wp_, subsitewp_7_Happy to adjust based on your coding standards or split into smaller PRs if preferred.