function drush_migrate_upgrade_rollback in Migrate Upgrade 8
Same name and namespace in other branches
- 8.3 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, and deletes the migrations themselves.
File
- ./
migrate_upgrade.drush.inc, line 63 - Command-line tools to aid performing and developing upgrade migrations.
Code
function drush_migrate_upgrade_rollback() {
if ($date_performed = \Drupal::state()
->get('migrate_upgrade.performed')) {
if (drush_confirm(dt('All migrations tagged as \'Drupal\' will be rolled back. Are you sure?'))) {
$runner = new MigrateUpgradeDrushRunner();
try {
drush_log(dt('Rolling back the upgrades performed @date', [
'@date' => \Drupal::service('date.formatter')
->format($date_performed),
]));
$runner
->rollback();
\Drupal::state()
->delete('migrate_upgrade.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');
}
}