You are here

function drush_migrate_wipe in Migrate 6.2

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

A drush command callback.

File

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

Code

function drush_migrate_wipe() {

  // Let's load user 1, seems to be need for creating path aliases and deleting content.
  global $user;
  $user_one = user_load(array(
    'uid' => '1',
  ));
  $user = $user_one;
  session_save_session(FALSE);
  $types = func_get_args();
  $nids = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', $types, 'IN')
    ->execute()
    ->fetchCol();
  migrate_instrument_start('node_delete');
  foreach ($nids as $nid) {
    node_delete($nid);
  }
  migrate_instrument_stop('node_delete');
}