Use the correct user table names when on multisite #66
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.
Description of the Change
Multisite: User and User Meta Table Names
This PR changes the way we are generating the
wp_users
andwp_usermeta
table names. Instead of$GLOBALS['table_prefix'] . 'users'
the code would use$wpdb->users
. Astable_prefix
varies in multisite installations depending on the main blog, this seems to a safer way to identify the correct table name.Multisite: Table Names
I don't know if I got an edge case but the script wasn't finding all tables, just the tables related to the main blog (that was not the original main one). Changing
$GLOBALS['table_prefix']
to$wpdb->base_prefix
we can get all tables with the "original" prefix set in thewp-config.php
file.As stated in the
$wpdb
documentation here:Column Statistics
Again, I don't know if it was a misconfiguration of my part but I ran into an
Unknown table 'COLUMN_STATISTICS' in information_schema
error. Adding--column-statistics=0
to allmysqldump
calls fixed the issue.More info in this Server Fault question.
Tablespaces
As per cbfa791, this PR also fixes the
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
errors adding a--no-tablespaces
parameter to the mysqldump calls.Data Escape
As related on #64, there is a lack of escaping in the current code. Commit f7f75cd tries to fix it.
Alternate Designs
I'm open to suggestions.
Benefits
WP Snapshots working good with multi-sites that changed the main blog id :)
Possible Drawbacks
n/a
Verification Process
I've cloned the repository locally and changed it as needed to generate a snapshot for my project.
Checklist:
Applicable Issues
Fixes #65 and #64
Changelog Entry
Fixed user scrubbing on multisites.