Follow-up to #2225775: Migrate Drupal 6 core node translation to Drupal 8
Problem/Motivation
In D8, a node revision has data for all languages. In D6 and D7, each node revision has data for just one language. This means currently D6 -> D8 and D7 -> D8 migrations yield a revision history where each node revision has only one language present, even if previous revisions had translations. This is strange and likely to confuse users.
Priority is given to the D7 migration because the D6 one might be effected by the term node migrations.
This is for migrating core translation revisions, migrating revisions for entity translation is now being done in #3076447: Migrate D7 entity translation revision translations to D8. It is intended that this issue is completed first and then the approach used here is also used for entity translations.
The following notes use the term 'master' which was the original term what is now the 'complete' node migration.
Meeting notes
Things to consider, taken from notes of meeting with alexpott, Gábor Hojtsy, heddn, mikelutz and quiteone
- Migration dependencies
- Possible: easy to do
- BC concerns: none
- BC what about contrib? Commerce / metatag
- How do we figure out you need the new complex master migration?
- Possible: moderate to do
- BC concerns: none
- Don’t effect expose new d*_node_master unless explicitly enabled to existing sites
- This handles incremental, no UI option available to enable
- For new installs, give an option to upgraders to enable disable the new d*_node_master migration and use the old method.
- What about migration lookups on dn_node etc.
- Possible: easy to do
- BC concerns: none
- What about incremental migrations that have already begun
- Not allowed. You can only use the new approach on a site that has not run migrations. So we need some of flag where existing installs use the old migrations.
- Contrib/Custom
- Does it make sense to use d*_node_master instead of d*_node migrations?
Proposed resolution
The current focus is to get the D7 version working and then move those changes to D6.
Using the existing method where the final revision is migrated first doesn't work instead the revisions need to be migrated in order. The first proof of concept patch to show this is in #121, thanks to mikelutz. This new approach is called the Complete node migration and the migrations and files use that name.
"Removing it [the classic node migrations] will break the whole ecosystem. Deprecating it means that it’s not used anymore which in and of itself will break the eco system, and for what benefit? To remove it in Drupal 10, a year after D7 is EOL? At that point we are looking at deprecating the entire D7 upgrade path anyway (Probably for removal in 11, not 10) We really don’t want to break the migration ecosystem right now at this critical time when we are trying to get everyone off of D7 in the next 18-20 months". by mikelutz in #migration on Drupal Slack). See #3109819: [PP-2] Deprecate classic node migration plugin in Drupal 9 for removal in Drupal 10 for discussion of when deprecation of classic node migrations would happen.
Run Complete or classic node migrations
However, the Complete approach doesn't integrate with the current migrations, now being called Classic, that is the one either runs the existing node migrations or the new complete one, not both. Choosing between the two methods is done at run time by checking the node migration map tables in MigrationConfigurationTrait() and migrate_drupal_migration_plugins_alter(). In the trait the classic method is selected if any of the classic node migrate_map tables has data (using processedCount) and in the plugins_alter it is selected if any classic node migrate_map exists and there are no complete node migrate_maps.
The selection of node migration method also allows tests to decide which method to use. The test does this by adding either 'node_migrate_classic' or 'node_migrate_complete' to $modules.
Altered migrations
There are several migrations that use migration_lookup on the node migration. The processes and dependencies for these are altered when the complete node migration is being run. The changes include new processes to convert the 3 destination IDs returned by complete node to the correct destination ID expected when using the classic migration.
The migrations altered are: d6_term_node, d6_term_node_revision, d6_term_node_translation, d6_comment, d6_url_alias,d7_comment, d7_url_alias, statistics_node_counter, node_translation_menu_links.
Incremental migrations
For the core UI, if map tables for the classic mode migrations exist and at least one has a row then the classic migrations will run and not the complete node migrations. This is determined at run time. Therefor, existing incremental migration should continue to function.
From the original IS
D6 and D7 node revisions do not directly indicate which other translated node revisions they are associated with. But we can attempt to guess this, based on the order of revisions.
Remaining tasks
Fix tests, add comments
Review
For Reviewers
- All level of code reviews welcome.
- There are BC issues raised in meeting notes, above
For Testers
- Use the lastest patch patch in this issue.
- There are instructions in the Issue summary of the META issue #2208401: [META] Stabilise Migrate Drupal Multilingual module
From #55
For developers
- Make this work with a multilingual source and a non multilingual source
- Discuss and document implications for drush, especially
drush migrate-upgrade --all
- Make sure the d6 and d7 tests includes testing a fields on each revision
- Handle the case where the vid of the first revision is higher the vid of a later revision. This is true for both d6 and d7.
- Make sure that the use of migration_tag 'translation' is documented. It is used in
- d6_node_translation.yml
- d7_node_entity_translation.yml
- d7_node_translation.yml
- d7_node_revision_translation.yml
- d7_user_entity_translation.yml
- d7_taxonomy_term_entity_translation.yml/li>
- d7_comment_entity_translation.yml
- d6_node_revision_translation.yml
- Make sure that the source plugin 'translation' property is documented
- Make sure that the destination plugin 'translations' property is documented
![]()