function drush_migrate_upgrade_rollback in Migrate Upgrade 8.3
Same name and namespace in other branches
- 8 migrate_upgrade.drush.inc \drush_migrate_upgrade_rollback()
- 8.2 migrate_upgrade.drush.inc \drush_migrate_upgrade_rollback()
Rolls back any upgrade migrations that are present.
File
- ./
migrate_upgrade.drush.inc, line 76 - Command-line tools to aid performing and developing upgrade migrations.
Code
function drush_migrate_upgrade_rollback() {
if ($date_performed = \Drupal::state()
->get('migrate_drupal_ui.performed')) {
if (drush_confirm(dt('All migrations tagged as \'Drupal\' will be rolled back. Are you sure?'))) {
$runner = new MigrateUpgradeDrushRunner(Drush::logger());
try {
drush_log(dt('Rolling back the upgrades performed @date', [
'@date' => \Drupal::service('date.formatter')
->format($date_performed),
]));
$runner
->rollback();
\Drupal::state()
->delete('migrate_drupal_ui.performed');
drush_log(dt('Rolled back upgrades'));
} catch (\Exception $e) {
drush_log($e
->getMessage(), 'error');
}
}
else {
drush_user_abort();
}
}
else {
drush_log(dt('No upgrade operation has been performed.'), 'warning');
}
}