-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import QTS slugs options and meta data into QTX #1171
Conversation
@spleen1981 please check this carefully on your side and let me know how it goes before merging it. Attention: the current options that may have been changed during the last commits in master (stored in This solves several issues of migration on activation which are hard to maintain and may create problems in the future. The main idea here is that manual import from QTS is required before being able to use slugs in QTX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good remarks
@spleen1981 I'm starting to think this is getting too complicated for what we need... and the problem of QTS cleanup is not solved yet. What about doing a import-migration instead?
No selective import, it's all or nothing. It looks like my first solution but the QTS legacy is not kept anymore, it's a full transfer. Pros:
Cons:
|
@herrvigg this solution is much better IMO, cons are not an issue as the legacy plugin is dead and is an external module anyways. I liked this approach more from the beginning, the simpler the better. |
1. delete existing QTX data 2. rename QTS keys for QTX
OK - finally! The new version is much simpler, it becomes a migration as described above:
There's a step 0, I added a temporary hack to preserve the options for master dev (solving cons point 2)! There was a nasty side effect of saving new options with new keys leading to empty slugs. The hack restores the previous QTS options as before so the migration falls back to the general case again (I didn't think about meta data at that time). It's really ugly but this will go away before release. Normal QTS users don't need this. The patch should be ready for review. For security, save the content of
Attention: all data are lost if done twice in a row without restoring QTS data! Let me know how it goes. |
* Remove internal QTS filter hooks The QTS filters come from the legacy plugin. There's no clear justification to use those in QTX. For easier maintenance remove those filters and replace them with direct calls instead. Rename validate term/post slugs as sanitize. Fix phpdoc. * Revert checks on empty slug strings
@spleen1981 let me know how the new version looks and I can merge it with an updated commit message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
- the checks on migrated items is made obsolete by new migration - the quick check is incompatible with renamed `qts_options`. Disable it temporarily, to be restored before new release.
- the checks on migrated items is made obsolete by new migration - the quick check is incompatible with renamed `qts_options`. Disable it temporarily, to be restored before new release.
When slugs is uninstalled all QTS data are erased and will be lost for QTX. The options and meta data from the legacy plugin should be properly imported in QTX to separate entries.
Add new features in the import settings to migrated QTS data:
postmeta
/termmeta
slugs are migrated renaming_qts_slug_
prefix toqtranslate_slug_
prefix.qts_options
slugs are migrated toqtranslate_module_slugs
options, after removing the_qts_
prefix for each type entry.ATTENTION: existing slugs options and meta before migration are erased! A confirmation is required. Without this, a dry-run mode allows to see the effects before change.
Update prefix constants accordingly for QTX:
QTS_META_PREFIX
toQTX_SLUGS_META_PREFIX
QTS_PREFIX
made obsolete.Add a new admin notice to suggest import when old QTS options and meta are found. The import can be done manually by the admin at any time.
Remove most of the HTML
id
attributes from the Slugs settings form, not needed (name
attributes matter).