Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
CCK field options are translated using i18n_cck submodule of the suite i18n, we need to migrate those respecting the language.
Use the d6 version as a guide #2961114: Migrate D6 i18n CCK field option translations
Proposed resolution
Additionally we should add an orderBy to the query in the source plugin because the test asserts the results in a specific order, and test it on PostgreSQL.
Patch
Review
Commit
Remaining tasks
- Write a test
- Write a patch to migrate field labels and options.
- Write a patch that combines #21 and #25
Comment | File | Size | Author |
---|---|---|---|
#33 | 3008029-33.patch | 25.95 KB | wilsonsp |
#33 | interdiff_21-33.txt | 545 bytes | wilsonsp |
#25 | drupal-3008029-maybe-fix-order-25.patch | 610 bytes | mradcliffe |
#21 | 3008029-21.patch | 25.92 KB | quietone |
#21 | interdiff-18-21.txt | 1.45 KB | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedNo longer postponed!
Comment #3
quietone CreditAttribution: quietone as a volunteer commentedSeems to me this should be migrate critical like the other i18n issues.
Comment #4
quietone CreditAttribution: quietone as a volunteer commentedComment #6
quietone CreditAttribution: quietone as a volunteer commentedShould be able to make a patch by the end of the week.
Comment #7
quietone CreditAttribution: quietone as a volunteer commentedComment #8
quietone CreditAttribution: quietone as a volunteer commentedComment #9
quietone CreditAttribution: quietone as a volunteer commentedComment #10
quietone CreditAttribution: quietone as a volunteer commentedAnd finally a patch.
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedRemove code for an earlier version of the test fixture and fix a coding standard error.
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedThe next thing I want to do is review the migration yml files, which were a quick copy/paste. I reckon they can be trimmed down.
Comment #14
quietone CreditAttribution: quietone as a volunteer commentedReworked the source plugin query and also trimmed out unnecessary items from the process pipeline.
Comment #16
quietone CreditAttribution: quietone as a volunteer commentedFix tests and remove debug coe.
Comment #17
Gábor HojtsyThanks for working on this. Only found a few things:
Why did you keep these here?
Is number indexing results the best approach? Are there precedents elsewhere? Should we name them instead?
Where does the type_name value actually come from? I am not seeing it in the query.
Comment #18
quietone CreditAttribution: quietone as a volunteer commented1. Because I didn't review my work.
2. The precedence is d6_field_instance_option_translation. If we were going to change that I would want to search for other instances of the same pattern and change them all at once. It would increase readability but I think only marginally.
3. Good point. Reason is the same as 1. That source plugin is not needed.
Comment #19
Gábor HojtsyLooks good to me now. Thanks for the quick update!
Comment #20
larowlanI think you can use
$query->fields('i18n')
here as a shortcut for 'add all the fields form this table'Same for the 'lt' alias
Other than that, this is over my head 🤔
Comment #21
quietone CreditAttribution: quietone as a volunteer commented@larowlan, thanks. Yes, that is messy.
Here is a tidier version. I changed the isNotNull('translation') to isNotNull('language') to be consistent with the intention of #3030937: Ensure language is not Null in translation source queries even though the decision over there (comments 16, 17) is to use an inner join. I didn't use the inner join because, frankly, I don't see how to make that work and there is precedence for using the isNotNull approach.
Comment #22
Gábor HojtsyLooks good to me. #3030937: Ensure language is not Null in translation source queries could either be solved by not null checks or inner join, where inner joins could be made to work. I am fine with either. The rest of the patch I already reviewed before, still looks complete and good.
Comment #23
larowlanCommitted b4192ba and pushed to 8.8.x. Thanks!
Comment #25
mradcliffeThis broke core branch tests in PostgreSQL: https://www.drupal.org/pift-ci-job/1373837
This is usually because of an assertion on the order of items when the order of items wasn't guaranteed in a query. If the order is not guaranteed, then there is no way to assert that the results will be selected in a certain order.
I think this is in an issue in the source plugin, but I can't tell for sure. I'll upload a patch here to see if my hypothesis is correct about the source plugin.
Comment #26
mradcliffeOkay, that looks pretty good. I'm going to re-open as Needs review to confirm the order by column is the correct lid to use.
Comment #27
mikelutzThe fix looks correct, indeterminate sort orders are a common source of issues with postgres (and differences between php versions too.) I'll RTBC the follow up patch for now, and leave it to the committers whether they want to just commit the follow up or revert. If they want to revert we can roll a combined patch to commit later.
Comment #29
xjmOops! Thanks for catching the postgres regression. I'm going to go ahead and revert this since HEAD is broken (and has been for days, oops -- I missed adding my email notifications for the branch).
After the revert we can combine #25 with the original fix to ensure this works with postgres.
We also should always run any Migrate patch against all three databases prior to commit. :)
Thanks!
Comment #30
xjmAlso crediting @mikelutz for the review of the fix.
Comment #31
wilsonspHi, I will try to combine the origin patch #21 with patch #25
Comment #32
mradcliffeWhat we will do is to download both the patches, apply them, and create a new patch. Then we should create an interdiff between the patch in #21 and this new patch, which should confirm that we are only introducing the changes in comment #25.
Edit: this was already outlined by @xjm above in #29 and I missed it. I'm sorry.
I adjusted the issue summary to describe the remaining work and new resolution.
Comment #33
wilsonspCombined patch #21 and #25, created a new patch and interdiff.
Comment #34
wilsonspAdd PostgreSQL to the issue tag
Comment #35
mikelutzFix looks good, RTBC contingent on the last postgres test coming back green.
No need to tag postgreSQL on the issue, it's not really a postgreSQL related issue at all, we just happened to have to make a small adjustment to make sure the tests pass on postgre
Comment #36
larowlanCommitted ae23684 and pushed to 8.8.x. Thanks!
Comment #39
xjmI don't actually know what field option translations are, but presumably it's a multilingual migrate improvement we might want to list along with the rest. Tagging accordingly. :)