You are here

function migrate_tools_drush_command in Migrate Tools 8

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

Implements hook_drush_command().

File

./migrate_tools.drush.inc, line 18
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' => 'Name of the migration group 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 BeerTerm,BeerNode' => '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' => 'Name of the migration group 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',
      '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' => 'Name 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 BeerTerm,BeerNode' => 'Import new terms and nodes',
      'migrate-import BeerUser --limit=2' => 'Import no more than 2 users',
      'migrate-import BeerUser --idlist=5' => 'Import the user record with source ID 5',
    ],
    'drupal dependencies' => [
      'migrate_tools',
    ],
    'aliases' => [
      'mi',
    ],
  ];
  $items['migrate-rollback'] = array(
    'description' => 'Rollback one or more migrations.',
    'options' => array(
      'all' => 'Process all migrations.',
      'group' => 'Name of the migration group to rollback',
      'feedback' => 'Frequency of progress messages, in items processed',
    ),
    'arguments' => array(
      'migration' => 'Name of migration(s) to rollback. Delimit multiple using commas.',
    ),
    'examples' => array(
      'migrate-rollback --all' => 'Perform all migrations',
      'migrate-rollback --group=beer' => 'Rollback all migrations in the beer group',
      'migrate-rollback BeerTerm,BeerNode' => 'Rollback imported terms and nodes',
    ),
    'drupal dependencies' => array(
      'migrate_tools',
    ),
    'aliases' => array(
      'mr',
    ),
  );
  $items['migrate-stop'] = [
    'description' => 'Stop an active migration operation.',
    'arguments' => [
      'migration' => 'Name 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' => 'Name of migration to reset',
    ],
    'drupal dependencies' => [
      'migrate_tools',
    ],
    'aliases' => [
      'mrs',
    ],
  ];
  $items['migrate-messages'] = [
    'description' => 'View any messages associated with a migration.',
    'arguments' => [
      'migration' => 'Name 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' => 'Name 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;
}