reverted: --- b/core/modules/content_translation/migrations/d6_node_revision_translation.yml +++ /dev/null @@ -1,44 +0,0 @@ -id: d6_node_revision_translation -label: Node revision translations -migration_tags: - - Drupal 6 - - translation - - Content - - Multilingual -deriver: Drupal\node\Plugin\migrate\D6NodeDeriver -source: - plugin: d6_node_revision - translations: true -process: - # If you are using this file to build a custom migration consider removing - # the nid field to allow incremental migrations. - nid: tnid - vid: vid - langcode: - plugin: default_value - source: language - default_value: "und" - title: title - uid: node_uid - status: status - created: created - changed: changed - promote: promote - sticky: sticky - 'body/format': - plugin: migration_lookup - migration: d6_filter_format - source: format - 'body/value': body - 'body/summary': teaser - revision_uid: revision_uid - revision_log: log - revision_timestamp: timestamp - content_translation_source: source_langcode -destination: - plugin: entity_revision:node - translations: true - destination_module: content_translation -migration_dependencies: - required: - - d6_node_translation reverted: --- b/core/modules/content_translation/migrations/d7_node_revision_translation.yml +++ /dev/null @@ -1,40 +0,0 @@ -id: d7_node_revision_translation -label: Node revision translations -migration_tags: - - Drupal 7 - - translation - - Content - - Multilingual -deriver: Drupal\node\Plugin\migrate\D7NodeDeriver -source: - plugin: d7_node_revision - translations: true -process: - # If you are using this file to build a custom migration consider removing - # the nid field to allow incremental migrations. - nid: tnid - vid: vid - langcode: - plugin: default_value - source: language - default_value: "und" - title: title - uid: node_uid - status: status - created: created - changed: changed - promote: promote - sticky: sticky - revision_uid: revision_uid - revision_log: log - revision_timestamp: timestamp - content_translation_source: source_langcode -destination: - plugin: entity_revision:node - translations: true - content_translation_update_definitions: - - node - destination_module: content_translation -migration_dependencies: - required: - - d7_node_translation diff -u b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php --- b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php @@ -59,27 +59,34 @@ * The revision log message. * @param string $field_text_field * The expected field_text_field field value. + * @param int $revision_translation_affected + * The revision translation affected field value. */ - protected function assertRevision($id, $langcode, $title, $log, $field_text_field) { + protected function assertRevision($id, $langcode, $title, $log, $field_text_field, $revision_translation_affected) { + /* @var \Drupal\node\NodeInterface $revision */ $revision = $this->nodeStorage->loadRevision($id)->getTranslation($langcode); $this->assertInstanceOf(NodeInterface::class, $revision); $this->assertSame($title, $revision->getTitle()); $this->assertSame($log, $revision->revision_log->value); $this->assertSame($field_text_field, $revision->field_text_field->value); + $this->assertSame($revision_translation_affected, $revision->get('revision_translation_affected')->value); } /** * Tests the migration of node revisions with translated nodes. */ public function testNodeTranslationRevisions() { - $this->assertRevision(13, 'en', 'The Real McCoy (first revision)', 'First revision (en)', 'McCoy first revision (en)'); - $this->assertRevision(14, 'fr', 'Le Vrai McCoy (first revision)', 'First revision (fr)', 'McCoy first revision (fr)'); - $this->assertRevision(15, 'zu', 'Abantu zulu (first revision)', 'First revision (zu)', 'Zulu first revision (zu)'); - $this->assertRevision(16, 'en', 'The Zulu People (first revision)', 'First revision (en)', 'Zulu first revision (en)'); - $this->assertRevision(24, 'en', 'The Real McCoy', 'Current revision (en)', 'McCoy current revision (en)'); - $this->assertRevision(25, 'fr', 'Le Vrai McCoy', 'Current revision (fr)', 'McCoy current revision (fr)'); - $this->assertRevision(26, 'zu', 'Abantu zulu', 'Current revision (zu)', 'Zulu current revision (zu)'); - $this->assertRevision(27, 'en', 'The Zulu People', 'Current revision (en)', 'Zulu current revision (en)'); + // Test the first revision. + $this->assertRevision(13, 'en', 'The Real McCoy (first revision)', 'First revision (en)', 'McCoy first revision (en)', '1'); + $this->assertRevision(14, 'fr', 'Le Vrai McCoy (first revision)', 'First revision (fr)', 'McCoy first revision (fr)', '1'); + $this->assertRevision(15, 'zu', 'Abantu zulu (first revision)', 'First revision (zu)', 'Zulu first revision (zu)', '1'); + $this->assertRevision(16, 'en', 'The Zulu People (first revision)', 'First revision (en)', 'Zulu first revision (en)', '1'); + + // Test the current revision. + $this->assertRevision(24, 'en', 'The Real McCoy', 'Current revision (en)', 'McCoy current revision (en)', '1'); + $this->assertRevision(2004, 'fr', 'Le Vrai McCoy', 'Current revision (fr)', 'McCoy current revision (fr)', '1'); + $this->assertRevision(26, 'zu', 'Abantu zulu', 'Current revision (zu)', 'Zulu current revision (zu)', '1'); + $this->assertRevision(2005, 'en', 'The Zulu People', 'Current revision (en)', 'Zulu current revision (en)', '1'); } } diff -u b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php --- b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php @@ -14,6 +14,7 @@ class MigrateNodeRevisionTest extends MigrateDrupal7TestBase { use FileMigrationSetupTrait; + /** * The entity storage for node. * @@ -50,6 +51,7 @@ $this->fileMigrationSetup(); + $this->installEntitySchema('node'); $this->installEntitySchema('comment'); $this->installEntitySchema('taxonomy_term'); $this->installSchema('comment', ['comment_entity_statistics']); @@ -67,7 +69,6 @@ 'd7_node_revision', 'd7_node_revision_translation', ]); - $this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node'); } @@ -96,27 +97,34 @@ * The revision log message. * @param string $field_text_plain * The expected field_text_plain field value. + * @param int $revision_translation_affected + * The revision translation affected field value. */ - protected function assertRevision($id, $langcode, $title, $log, $field_text_plain) { + protected function assertRevision($id, $langcode, $title, $log, $field_text_plain, $revision_translation_affected) { + /* @var \Drupal\node\NodeInterface $revision */ $revision = $this->nodeStorage->loadRevision($id)->getTranslation($langcode); $this->assertInstanceOf(NodeInterface::class, $revision); $this->assertSame($title, $revision->getTitle()); $this->assertSame($log, $revision->revision_log->value); $this->assertSame($field_text_plain, $revision->field_text_plain->value); + $this->assertSame($revision_translation_affected, $revision->get('revision_translation_affected')->value); } /** * Tests the migration of node revisions with translated nodes. */ public function testNodeTranslationRevisions() { - $this->assertRevision(2, 'en', 'The thing about Deep Space 9 (first revision)', 'First revision (en)', 'DS9 first revision (en)'); - $this->assertRevision(3, 'is', 'is - The thing about Deep Space 9 (first revision)', 'First revision (is)', 'DS9 first revision (is)'); - $this->assertRevision(4, 'is', 'is - The thing about Firefly (first revision)', 'First revision (is)', 'Firefly first revision (is)'); - $this->assertRevision(5, 'en', 'en - The thing about Firefly (first revision)', 'First revision (en)', 'Firefly first revision (en)'); - $this->assertRevision(8, 'en', 'The thing about Deep Space 9', 'Current revision (en)', 'DS9 current revision (en)'); - $this->assertRevision(9, 'is', 'is - The thing about Deep Space 9', 'Current revision (is)', 'DS9 current revision (is)'); - $this->assertRevision(10, 'is', 'is - The thing about Firefly', 'Current revision (is)', 'Firefly current revision (is)'); - $this->assertRevision(11, 'en', 'en - The thing about Firefly', 'Current revision (en)', 'Firefly current revision (en)'); + // Test the first revision. + $this->assertRevision(2, 'en', 'The thing about Deep Space 9 (first revision)', 'First revision (en)', 'DS9 first revision (en)', '1'); + $this->assertRevision(3, 'is', 'is - The thing about Deep Space 9 (first revision)', 'First revision (is)', 'DS9 first revision (is)', '1'); + $this->assertRevision(4, 'is', 'is - The thing about Firefly (first revision)', 'First revision (is)', 'Firefly first revision (is)', '1'); + $this->assertRevision(5, 'en', 'en - The thing about Firefly (first revision)', 'First revision (en)', 'Firefly first revision (en)', '1'); + + // Test the current revision. + $this->assertRevision(8, 'en', 'The thing about Deep Space 9', 'Current revision (en)', 'DS9 current revision (en)', '1'); + $this->assertRevision(11, 'is', 'is - The thing about Deep Space 9', 'Current revision (is)', 'DS9 current revision (is)', '1'); + $this->assertRevision(10, 'is', 'is - The thing about Firefly', 'Current revision (is)', 'Firefly current revision (is)', '1'); + $this->assertRevision(12, 'en', 'en - The thing about Firefly', 'Current revision (en)', 'Firefly current revision (en)', '1'); } } only in patch2: unchanged: --- a/core/modules/node/migrations/d6_node_revision.yml +++ b/core/modules/content_translation/migrations/d6_node_revision_translation.yml @@ -1,16 +1,20 @@ -id: d6_node_revision -label: Node revisions -audit: true +id: d6_node_revision_translation +label: Node revision translations migration_tags: - Drupal 6 + - translation - Content + - Multilingual deriver: Drupal\node\Plugin\migrate\D6NodeDeriver source: plugin: d6_node_revision + translations: true + constants: + revision_translation_affected: true process: # If you are using this file to build a custom migration consider removing - # the nid and vid fields to allow incremental migrations. - nid: nid + # the nid field to allow incremental migrations. + nid: tnid vid: vid langcode: plugin: default_value @@ -32,12 +36,12 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp - -# unmapped d6 fields. -# tnid -# translate -# moderate -# comment - + content_translation_source: source_langcode + revision_translation_affected: constants/revision_translation_affected destination: plugin: entity_revision:node + translations: true + destination_module: content_translation +migration_dependencies: + required: + - d6_node_translation only in patch2: unchanged: --- a/core/modules/node/migrations/d7_node_revision.yml +++ b/core/modules/content_translation/migrations/d7_node_revision_translation.yml @@ -1,16 +1,18 @@ -id: d7_node_revision -label: Node revisions -audit: true +id: d7_node_revision_translation +label: Node revision translations migration_tags: - Drupal 7 + - translation - Content + - Multilingual deriver: Drupal\node\Plugin\migrate\D7NodeDeriver source: plugin: d7_node_revision + translations: true process: # If you are using this file to build a custom migration consider removing - # the nid and vid fields to allow incremental migrations. - nid: nid + # the nid field to allow incremental migrations. + nid: tnid vid: vid langcode: plugin: default_value @@ -26,8 +28,13 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp + content_translation_source: source_langcode destination: plugin: entity_revision:node + translations: true + content_translation_update_definitions: + - node + destination_module: content_translation migration_dependencies: required: - - d7_node + - d7_node_translation only in patch2: unchanged: --- a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php @@ -105,6 +105,7 @@ protected function migrateContent(array $include = []) { if (in_array('translations', $include)) { $this->executeMigrations(['d6_node_translation']); + $this->executeMigrations(['d6_node_revision_translation']); } if (in_array('revisions', $include)) { $this->executeMigrations(['d6_node_revision']); only in patch2: unchanged: --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php @@ -68,8 +68,8 @@ protected function getEntityCounts() { 'contact_message' => 0, 'configurable_language' => 5, 'editor' => 2, - 'field_config' => 91, - 'field_storage_config' => 65, + 'field_config' => 92, + 'field_storage_config' => 66, 'file' => 7, 'filter_format' => 7, 'image_style' => 5, only in patch2: unchanged: --- a/core/modules/node/migrations/d6_node.yml +++ b/core/modules/node/migrations/d6_node.yml @@ -7,6 +7,8 @@ migration_tags: deriver: Drupal\node\Plugin\migrate\D6NodeDeriver source: plugin: d6_node + constants: + revision_translation_affected: true process: # In D6, nodes always have a tnid, but it's zero for untranslated nodes. # We normalize it to equal the nid in that case. @@ -35,7 +37,7 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp - + revision_translation_affected: constants/revision_translation_affected # unmapped d6 fields. # tnid # translate only in patch2: unchanged: --- a/core/modules/node/migrations/d6_node_revision.yml +++ b/core/modules/node/migrations/d6_node_revision.yml @@ -7,6 +7,8 @@ migration_tags: deriver: Drupal\node\Plugin\migrate\D6NodeDeriver source: plugin: d6_node_revision + constants: + revision_translation_affected: true process: # If you are using this file to build a custom migration consider removing # the nid and vid fields to allow incremental migrations. @@ -32,7 +34,7 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp - + revision_translation_affected: constants/revision_translation_affected # unmapped d6 fields. # tnid # translate only in patch2: unchanged: --- a/core/modules/node/migrations/d7_node.yml +++ b/core/modules/node/migrations/d7_node.yml @@ -7,6 +7,8 @@ migration_tags: deriver: Drupal\node\Plugin\migrate\D7NodeDeriver source: plugin: d7_node + constants: + revision_translation_affected: true process: # If you are using this file to build a custom migration consider removing # the nid and vid fields to allow incremental migrations. @@ -29,6 +31,7 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp + revision_translation_affected: constants/revision_translation_affected destination: plugin: entity:node migration_dependencies: only in patch2: unchanged: --- a/core/modules/node/migrations/d7_node_revision.yml +++ b/core/modules/node/migrations/d7_node_revision.yml @@ -7,6 +7,8 @@ migration_tags: deriver: Drupal\node\Plugin\migrate\D7NodeDeriver source: plugin: d7_node_revision + constants: + revision_translation_affected: true process: # If you are using this file to build a custom migration consider removing # the nid and vid fields to allow incremental migrations. @@ -26,6 +28,7 @@ process: revision_uid: revision_uid revision_log: log revision_timestamp: timestamp + revision_translation_affected: constants/revision_translation_affected destination: plugin: entity_revision:node migration_dependencies: