function migrate_tools_drush_command in Migrate Tools 8.4
Same name and namespace in other branches
- 8 migrate_tools.drush.inc \migrate_tools_drush_command()
- 8.2 migrate_tools.drush.inc \migrate_tools_drush_command()
- 8.3 migrate_tools.drush.inc \migrate_tools_drush_command()
Implements hook_drush_command().
File
- ./
migrate_tools.drush.inc, line 19 - Command-line tools to aid performing and developing migrations.
Code
function migrate_tools_drush_command() {
$items['migrate-status'] = [
'description' => 'List all migrations with current status.',
'options' => [
'group' => 'A comma-separated list of migration groups to list',
'tag' => 'Name of the migration tag to list',
'names-only' => 'Only return names, not all the details (faster)',
],
'arguments' => [
'migration' => 'Restrict to a comma-separated list of migrations. Optional',
],
'examples' => [
'migrate-status' => 'Retrieve status for all migrations',
'migrate-status --group=beer' => 'Retrieve status for all migrations in a given group',
'migrate-status --tag=user' => 'Retrieve status for all migrations with a given tag',
'migrate-status --group=beer --tag=user' => 'Retrieve status for all migrations in the beer group and with the user tag',
'migrate-status beer_term,beer_node' => 'Retrieve status for specific migrations',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'ms',
],
];
$items['migrate-import'] = [
'description' => 'Perform one or more migration processes.',
'options' => [
'all' => 'Process all migrations.',
'group' => 'A comma-separated list of migration groups to import',
'tag' => 'Name of the migration tag to import',
'limit' => 'Limit on the number of items to process in each migration',
'feedback' => 'Frequency of progress messages, in items processed',
'idlist' => 'Comma-separated list of IDs to import',
'idlist-delimiter' => 'The delimiter for records, defaults to \':\'',
'update' => ' In addition to processing unprocessed items from the source, update previously-imported items with the current data',
'force' => 'Force an operation to run, even if all dependencies are not satisfied',
'execute-dependencies' => 'Execute all dependent migrations first.',
],
'arguments' => [
'migration' => 'ID of migration(s) to import. Delimit multiple using commas.',
],
'examples' => [
'migrate-import --all' => 'Perform all migrations',
'migrate-import --group=beer' => 'Import all migrations in the beer group',
'migrate-import --tag=user' => 'Import all migrations with the user tag',
'migrate-import --group=beer --tag=user' => 'Import all migrations in the beer group and with the user tag',
'migrate-import beer_term,beer_node' => 'Import new terms and nodes',
'migrate-import beer_user --limit=2' => 'Import no more than 2 users',
'migrate-import beer_user --idlist=5' => 'Import the user record with source ID 5',
'migrate-import beer_node_revision --idlist=1:2,2:3,3:5' => "Import the node revision record with source IDs [1,2], [2,3], and [3,5]",
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mi',
'mim',
],
];
$items['migrate-rollback'] = [
'description' => 'Rollback one or more migrations.',
'options' => [
'all' => 'Process all migrations.',
'group' => 'A comma-separated list of migration groups to rollback',
'tag' => 'ID of the migration tag to rollback',
'feedback' => 'Frequency of progress messages, in items processed',
'idlist' => 'Comma-separated list of IDs to import',
'idlist-delimiter' => 'The delimiter for records, defaults to \':\'',
],
'arguments' => [
'migration' => 'Name of migration(s) to rollback. Delimit multiple using commas.',
'idlist' => 'Comma-separated list of IDs to import',
],
'examples' => [
'migrate-rollback --all' => 'Perform all migrations',
'migrate-rollback --group=beer' => 'Rollback all migrations in the beer group',
'migrate-rollback --tag=user' => 'Rollback all migrations with the user tag',
'migrate-rollback --group=beer --tag=user' => 'Rollback all migrations in the beer group and with the user tag',
'migrate-rollback beer_term,beer_node' => 'Rollback imported terms and nodes',
'migrate-rollback beer_user --idlist=5' => 'Rollback imported user record with source ID 5',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mr',
],
];
$items['migrate-stop'] = [
'description' => 'Stop an active migration operation.',
'arguments' => [
'migration' => 'ID of migration to stop',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mst',
],
];
$items['migrate-reset-status'] = [
'description' => 'Reset a active migration\'s status to idle.',
'arguments' => [
'migration' => 'ID of migration to reset',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mrs',
],
];
$items['migrate-messages'] = [
'description' => 'View any messages associated with a migration.',
'arguments' => [
'migration' => 'ID of the migration',
],
'options' => [
'csv' => 'Export messages as a CSV',
],
'examples' => [
'migrate-messages MyNode' => 'Show all messages for the MyNode migration',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mmsg',
],
];
$items['migrate-fields-source'] = [
'description' => 'List the fields available for mapping in a source.',
'arguments' => [
'migration' => 'ID of the migration',
],
'examples' => [
'migrate-fields-source my_node' => 'List fields for the source in the my_node migration',
],
'drupal dependencies' => [
'migrate_tools',
],
'aliases' => [
'mfs',
],
];
return $items;
}