public function MigrateUpgradeDrushRunner::rollback in Migrate Upgrade 8.2
Same name and namespace in other branches
- 8.3 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::rollback()
- 8 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::rollback()
Rolls back the configured migrations.
File
- src/
MigrateUpgradeDrushRunner.php, line 266
Class
Namespace
Drupal\migrate_upgradeCode
public function rollback() {
static::$messages = new DrushLogMigrateMessage();
$database_state_key = \Drupal::state()
->get('migrate.fallback_state_key');
$database_state = \Drupal::state()
->get($database_state_key);
$db_spec = $database_state['database'];
$connection = $this
->getConnection($db_spec);
$version = $this
->getLegacyDrupalVersion($connection);
$migrations = $this
->getMigrations('migrate_drupal_' . $version, $version);
// Roll back in reverse order.
$this->migrationList = array_reverse($migrations);
foreach ($migrations as $migration) {
drush_print(dt('Rolling back @migration', [
'@migration' => $migration
->id(),
]));
$executable = new MigrateExecutable($migration, static::$messages);
// drush_op() provides --simulate support.
drush_op([
$executable,
'rollback',
]);
}
}