Problem/Motivation

Sub-issue for #2746527: [META] Handle data related to Drupal 6 and 7 node translations with different IDs.

When migrating path aliases of translated nodes, some aliases will point to non-existent nodes since source and translations are stored in the same node.

If in D7 we have node/1 as the source in English and node/2 as the French translation, in D8 we will only have node/1. If we had an alias for node/2, it won't work anymore.

Proposed resolution

When migrating path aliases, use the migration process plugin to get the translation source nid and correct the translation path aliases.

Remaining tasks

Write a patch. Write a test. Review.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#3 interdiff-2-3.txt1.96 KBmaxocub
#3 2850984-3.patch3.88 KBmaxocub
#2 2850984-2.patch3.89 KBmaxocub

Comments

maxocub created an issue. See original summary.

maxocub’s picture

Assigned: maxocub » Unassigned
Status: Active » Needs review
StatusFileSize
new3.89 KB
maxocub’s picture

Issue summary: View changes
StatusFileSize
new3.88 KB
new1.96 KB

Few cosmetic changes.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

+++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
@@ -43135,6 +43135,30 @@
+  'source' => 'node/5',

+++ b/core/modules/path/migration_templates/d7_url_alias.yml
@@ -18,5 +18,17 @@ process:
+  node_translation:
+    -
+      plugin: explode
+      source: source
+      delimiter: /
+    -
+      plugin: extract
+      index:
+        - 1
+    -
+      plugin: migration
+      migration: d7_node_translation
 destination:

Don't we need to do ensure that the start of the path is node/ because might we otherwise convert an alias like user/1 to something else?

Ah we do that in the destination in \Drupal\path\Plugin\migrate\destination\UrlAlias::import(). So one thing that's obvious is that on a really big site this might lots and lots of lookups for no reason.

There are lots and lots of issues with migrate performance. And this works the same way as the D6 one so I guess this is okay.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 0b45cbb to 8.4.x and c6fe1b2 to 8.3.x. Thanks!

  • alexpott committed 0b45cbb on 8.4.x
    Issue #2850984 by maxocub: Fix path alias migration of translated nodes...

  • alexpott committed c6fe1b2 on 8.3.x
    Issue #2850984 by maxocub: Fix path alias migration of translated nodes...
alexpott’s picture

I added this to 8.3.x because migrate is still in beta and also the changes here are to the template - just leveraging functionality we already have for d6 migration.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

maxocub’s picture