diff core/modules/migrate_drupal/src/MigrationConfigurationTrait.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
line wrap: on
line diff
--- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php	Tue Jul 10 15:07:59 2018 +0100
@@ -13,6 +13,13 @@
 trait MigrationConfigurationTrait {
 
   /**
+   * The follow-up migration tags.
+   *
+   * @var string[]
+   */
+  protected $followUpMigrationTags;
+
+  /**
    * Gets the database connection for the source Drupal database.
    *
    * @param array $database
@@ -96,6 +103,13 @@
     $all_migrations = $plugin_manager->createInstancesByTag($version_tag);
     $migrations = [];
     foreach ($all_migrations as $migration) {
+      // Skip migrations tagged with any of the follow-up migration tags. They
+      // will be derived and executed after the migrations on which they depend
+      // have been successfully executed.
+      // @see Drupal\migrate_drupal\Plugin\MigrationWithFollowUpInterface
+      if (!empty(array_intersect($migration->getMigrationTags(), $this->getFollowUpMigrationTags()))) {
+        continue;
+      }
       try {
         // @todo https://drupal.org/node/2681867 We should be able to validate
         //   the entire migration at this point.
@@ -120,6 +134,20 @@
   }
 
   /**
+   * Returns the follow-up migration tags.
+   *
+   * @return string[]
+   */
+  protected function getFollowUpMigrationTags() {
+    if ($this->followUpMigrationTags === NULL) {
+      $this->followUpMigrationTags = \Drupal::configFactory()
+        ->get('migrate_drupal.settings')
+        ->get('follow_up_migration_tags') ?: [];
+    }
+    return $this->followUpMigrationTags;
+  }
+
+  /**
    * Determines what version of Drupal the source database contains.
    *
    * @param \Drupal\Core\Database\Connection $connection