You are here

function pmperson_migrate_content_kill in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_content_kill()
  2. 7.2 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_content_kill()

Delete all pmperson nodes.

1 call to pmperson_migrate_content_kill()
pmperson_migrate in pmperson/includes/pmperson.migrate.inc
Helper function for migrating between PM Person nodes and Drupal users.

File

pmperson/includes/pmperson.migrate.inc, line 65
Migration functions for the PM Person module.

Code

function pmperson_migrate_content_kill(&$sandbox) {
  $results = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', 'pmperson')
    ->condition('nid', $sandbox['pmperson_current_nid_of_node_being_deleted'], '>')
    ->range(0, PMPERSON_MIGRATE_MAX_JOB_PER_BATCH)
    ->execute();
  $count = 0;
  foreach ($results as $result) {
    $count++;
    $nids[] = $result->nid;
    $sandbox['pmperson_current_nid_of_node_being_deleted'] = $result->nid;
  }
  if (!empty($nids)) {
    node_delete_multiple($nids);
  }
  return empty($count);
}