You are here

function migrate_drush_command in Migrate 6

Same name and namespace in other branches
  1. 6.2 migrate.drush.inc \migrate_drush_command()
  2. 7.2 migrate.drush.inc \migrate_drush_command()

Implementation of hook_drush_command().

File

./migrate.drush.inc, line 29
Drush support for the migrate module

Code

function migrate_drush_command() {
  $migration_options = array(
    '--itemlimit' => 'The maximum number of items to migrate. If unspecified, all are migrated',
    '--feedback' => 'Frequency of progress messages, in seconds or items processed',
    '--idlist' => 'A comma delimited list of ids to import or clear. If unspecified, migrate imports all pending items or clears all items for the content set.',
    '--all' => 'Process all content sets',
  );
  $items['migrate-status'] = array(
    'description' => 'List all content sets with current status.',
  );
  $items['migrate-clear'] = array(
    'description' => 'Clear migrated data for the specified content set',
    'options' => $migration_options,
    // We will bootstrap to login from within the command callback.
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
    'arguments' => array(
      'content_set' => 'Name or mcsid of content set to clear',
    ),
    'examples' => array(
      'migrate-clear 4' => 'Clear the content set with mcsid 4',
      'migrate-clear 4 --idlist=4,9' => 'Clear two items in mcsid 4. The ids refer to the value of the primary key in base table',
      'migrate-clear Articles --itemlimit=50' => 'Clear up to 50 items from the content set named Articles',
      'migrate-clear Users --feedback="60 seconds"' => 'Display a progress message every 60 seconds or less',
      'migrate-clear 2 --feedback="1000 items"' => 'Display a progress message every 1000 processed items or less',
    ),
  );
  $migration_options['--update'] = 'In addition to processing unimported items from the source, update previously-imported items with new data';
  $items['migrate-import'] = array(
    'description' => 'Import a given migration content set',
    'options' => $migration_options,
    'arguments' => array(
      'content_set' => 'Name or mcsid of content set to import',
    ),
    'examples' => array(
      'migrate-import 4' => 'Import new items in the content set with mcsid 4',
      'migrate-import 4 --update' => 'Import new items, and also update previously-imported items',
      'migrate-import 4 --idlist=4,9' => 'Import two items in mcsid 4. The ids refer to the value of the primary key in base table',
      'migrate-import Articles --itemlimit=50' => 'Import up to 50 items from the content set named Articles',
      'migrate-import Users --feedback="60 seconds"' => 'Display a progress message every 60 seconds or less',
      'migrate-import 2 --feedback="1000 items"' => 'Display a progress message every 1000 processed items or less',
    ),
  );
  $items['migrate-stop'] = array(
    'description' => 'Stop an active migration operation',
    'options' => array(
      '--all' => 'Stop all active migration operations',
    ),
    'arguments' => array(
      'content_set' => 'Name or mcsid of content set to stop',
    ),
    'examples' => array(
      'migrate-stop Articles' => 'Stop any active operation on the Articles content set',
      'migrate-stop --all' => 'Stop all active migration operations',
    ),
  );
  $items['migrate-wipe'] = array(
    'description' => 'Delete all nodes from specified content types.',
    'examples' => array(
      "migrate-wipe story article" => 'Delete all story and article nodes.',
    ),
    'arguments' => array(
      'type' => 'A space delimited list of content type machine readable Ids.',
    ),
    // We will bootstrap to login from within the command callback.
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
  );
  return $items;
}