summaryrefslogtreecommitdiffstats
path: root/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/migrate_drupal/src/MigrationConfigurationTrait.php')
-rw-r--r--core/modules/migrate_drupal/src/MigrationConfigurationTrait.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
index b566c82..0aca5be 100644
--- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
+++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
@@ -13,6 +13,13 @@ use Drupal\migrate\Plugin\RequirementsInterface;
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 @@ trait MigrationConfigurationTrait {
$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 @@ trait MigrationConfigurationTrait {
}
/**
+ * 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