You are here

function drush_content_migrate_rollback in Content Construction Kit (CCK) 7.3

Command callback.

File

modules/content_migrate/includes/content_migrate.drush.inc, line 144
content_migrate.drush.inc Drush commands for content_migrate,

Code

function drush_content_migrate_rollback() {
  $field_names = drush_content_migrate_get_fields(_convert_csv_to_array(func_get_args()), 'converted');
  if (empty($field_names)) {
    return drush_set_error('CONTENT_MIGRATE_NOTHING_TO_DO', dt('No fields to roll back.'));
  }
  drush_log(dt('The following fields will be rolled back: !fields', array(
    '!fields' => implode(', ', $field_names),
  )), 'status');
  drush_log(dt('Rolling fields back will completely destroy the new field tables. This operation cannot be undone!'), 'warning');
  if (!drush_confirm(dt('Do you really want to continue?'))) {
    return drush_user_abort();
  }
  content_migrate_rollback($field_names);

  // Print messages here, so we can give our status at the end.
  // TODO: make an API function for this in Drush.
  _drush_log_drupal_messages();
  drush_log(dt('Roll back complete'), 'status');
}