You are here

function drush_migrate_tools_migrate_reset_status in Migrate Tools 8

Same name and namespace in other branches
  1. 8.2 migrate_tools.drush.inc \drush_migrate_tools_migrate_reset_status()
  2. 8.3 migrate_tools.drush.inc \drush_migrate_tools_migrate_reset_status()
  3. 8.4 migrate_tools.drush.inc \drush_migrate_tools_migrate_reset_status()

Parameters

string $migration_id:

File

./migrate_tools.drush.inc, line 329
Command-line tools to aid performing and developing migrations.

Code

function drush_migrate_tools_migrate_reset_status($migration_id = '') {

  /** @var Migration $migration */
  $migration = Migration::load($migration_id);
  if ($migration) {
    $status = $migration
      ->getStatus();
    if ($status == MigrationInterface::STATUS_IDLE) {
      drush_log(dt('Migration @id is already Idle', [
        '@id' => $migration_id,
      ]), 'warning');
    }
    else {
      $migration
        ->setStatus(MigrationInterface::STATUS_IDLE);
      drush_log(dt('Migration @id reset to Idle', [
        '@id' => $migration_id,
      ]), 'status');
    }
  }
  else {
    drush_log(dt('Migration @id does not exist', [
      '@id' => $migration_id,
    ]), 'error');
  }
}