diff -u b/core/modules/content_translation/migrations/d6_node_master.yml b/core/modules/content_translation/migrations/d6_node_master.yml --- b/core/modules/content_translation/migrations/d6_node_master.yml +++ b/core/modules/content_translation/migrations/d6_node_master.yml @@ -1,3 +1,4 @@ +# Migrates all revisions and all revision translations. id: d6_node_master label: Node Master audit: true diff -u b/core/modules/content_translation/migrations/d7_node_master.yml b/core/modules/content_translation/migrations/d7_node_master.yml --- b/core/modules/content_translation/migrations/d7_node_master.yml +++ b/core/modules/content_translation/migrations/d7_node_master.yml @@ -1,3 +1,4 @@ +# Migrates all revisions and all revision translations. id: d7_node_master label: Nodes audit: true diff -u b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentMaster.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentMaster.php --- b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentMaster.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentMaster.php @@ -39,6 +39,9 @@ /** * {@inheritdoc} + * + * @todo: Use EntityFieldDefinitionTrait instead. + * See https://www.drupal.org/project/drupal/issues/2937782. */ protected static function getEntityTypeId($plugin_id) { // Remove entity_revision: diff -u b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php --- b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -971,6 +971,7 @@ * {@inheritdoc} */ public function getHighestId() { + // Ensure that at least one Id is an integer. if (array_search('integer', array_column($this->migration->getDestinationPlugin()->getIds(), 'type')) === FALSE) { throw new \LogicException('Cannot determine the highest migrated ID without an integer ID column'); }; diff -u b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php --- b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php +++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php @@ -103,12 +103,20 @@ /** @var \Drupal\migrate\Plugin\Migration[] $all_migrations */ $all_migrations = $plugin_manager->createInstancesByTag($version_tag); + // If this source database is multilingual then we must run only the + // dN_node_master migration and not any other dN_node* migration. + // Conversely, if the source database is not multilingual then we want to + // run all dN_node* migrations except dN_node_master. Here we unset the + // migrations we don't want to run. if ($this->isMultilingualSource($database_state_key, $drupal_version)) { $patterns = '/(d' . $drupal_version . '_node:)|(d' . $drupal_version . '_node_translation:)|(d' . $drupal_version . '_node_revision:)/'; - foreach ($all_migrations as $key => $migrations) { - if (preg_match($patterns, $key)) { - unset($all_migrations[$key]); - } + } + else { + $patterns = '/(d' . $drupal_version . '_node_master:)/'; + } + foreach ($all_migrations as $key => $migrations) { + if (preg_match($patterns, $key)) { + unset($all_migrations[$key]); } } @@ -221,7 +229,7 @@ } /** - * Determines if the source database uses i18n module. + * Determines if the i18n module is installed in the source database. * * @return bool * The version if this is a source database with i18n, FALSE otherwise. @@ -233,7 +241,7 @@ $connection = $this->getConnection($database_state['database']); if ($connection) { $status = $connection->query("SELECT status FROM {system} WHERE name = :name and type = :type", [ - ':name' => 'system', + ':name' => 'i18n', ':type' => 'module', ])->fetchField(); } diff -u b/core/modules/migrate_drupal_ui/src/Form/IdConflictForm.php b/core/modules/migrate_drupal_ui/src/Form/IdConflictForm.php --- b/core/modules/migrate_drupal_ui/src/Form/IdConflictForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/IdConflictForm.php @@ -74,7 +74,11 @@ $results = (new IdAuditor())->auditMultiple($migrations); - // Get the audit results for node revisions for the node_master migrations. + // If dN_node_master migration is being used get the audit results for node + // revisions manually. We need to do this manually because the node master + // map has the ids for both nodes and revisions and Sql::getHighestId() + // only returns the highest migrated ID of the destination entity type, + // which for node_master is node. $migration_plugin_manager = \Drupal::service('plugin.manager.migration'); foreach ($migrations as $migration) { $migration_id = $migration->getPluginId(); diff -u b/core/modules/node/src/Plugin/migrate/source/d6/NodeMaster.php b/core/modules/node/src/Plugin/migrate/source/d6/NodeMaster.php --- b/core/modules/node/src/Plugin/migrate/source/d6/NodeMaster.php +++ b/core/modules/node/src/Plugin/migrate/source/d6/NodeMaster.php @@ -3,7 +3,7 @@ namespace Drupal\node\Plugin\migrate\source\d6; /** - * Master node source. + * Gets all node revisions from the source, including translation revisions. * * @MigrateSource( * id = "d6_node_master", diff -u b/core/modules/node/src/Plugin/migrate/source/d7/NodeMaster.php b/core/modules/node/src/Plugin/migrate/source/d7/NodeMaster.php --- b/core/modules/node/src/Plugin/migrate/source/d7/NodeMaster.php +++ b/core/modules/node/src/Plugin/migrate/source/d7/NodeMaster.php @@ -5,7 +5,7 @@ use Drupal\Core\Database\Query\SelectInterface; /** - * Master node source. + * Gets all node revisions from the source, including translation revisions. * * @MigrateSource( * id = "d7_node_master", @@ -52,6 +52,5 @@ * {@inheritdoc} */ - protected function handleTranslations(SelectInterface $query) { - } + protected function handleTranslations(SelectInterface $query) {} }