function drush_migrate_tools_migrate_stop in Migrate Tools 8
Same name and namespace in other branches
- 8.2 migrate_tools.drush.inc \drush_migrate_tools_migrate_stop()
- 8.3 migrate_tools.drush.inc \drush_migrate_tools_migrate_stop()
- 8.4 migrate_tools.drush.inc \drush_migrate_tools_migrate_stop()
Parameters
string $migration_id:
File
- ./
migrate_tools.drush.inc, line 300 - Command-line tools to aid performing and developing migrations.
Code
function drush_migrate_tools_migrate_stop($migration_id = '') {
/** @var Migration $migration */
$migration = Migration::load($migration_id);
if ($migration) {
$status = $migration
->getStatus();
switch ($status) {
case MigrationInterface::STATUS_IDLE:
drush_log(dt('Migration @id is idle', [
'@id' => $migration_id,
]), 'warning');
break;
case MigrationInterface::STATUS_DISABLED:
drush_log(dt('Migration @id is disabled', [
'@id' => $migration_id,
]), 'warning');
break;
case MigrationInterface::STATUS_STOPPING:
drush_log(dt('Migration @id is already stopping', [
'@id' => $migration_id,
]), 'warning');
break;
default:
$migration
->interruptMigration(MigrationInterface::RESULT_STOPPED);
drush_log(dt('Migration @id requested to stop', [
'@id' => $migration_id,
]), 'success');
break;
}
}
else {
drush_log(dt('Migration @id does not exist', [
'@id' => $migration_id,
]), 'error');
}
}