You are here

function user_delete_node_mass_delete in User Delete 6.2

Make mass deletion of nodes.

IMPORTANT NOTE: This function is intended to work when called from a form submit handler. Calling it outside of the form submission process may not work correctly.

Parameters

array $nodes: Array of node nids to update.

1 call to user_delete_node_mass_delete()
user_delete_node_cancel in ./user_delete.module
Mimics hook_user_cancel() for node module.

File

./user_delete.module, line 719
Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.

Code

function user_delete_node_mass_delete($nodes) {

  // We use batch processing to prevent timeout when updating a large number
  // of nodes.
  if (count($nodes) > 10) {
    $batch = array(
      'operations' => array(
        array(
          '_user_delete_node_mass_delete_batch_process',
          array(
            $nodes,
          ),
        ),
      ),
      'finished' => '_user_delete_node_mass_delete_batch_finished',
      'title' => t('Processing'),
      // We use a single multi-pass operation, so the default
      // 'Remaining x of y operations' message will be confusing here.
      'progress_message' => '',
      'error_message' => t('The delete has encountered an error.'),
      // The operations do not live in the .module file, so we need to
      // tell the batch engine which file to load before calling them.409
      'file' => drupal_get_path('module', 'node') . '/node.admin.inc',
    );
    batch_set($batch);
  }
  else {
    foreach ($nodes as $nid) {
      _user_delete_node_mass_delete_helper($nid);
    }
    drupal_set_message(t('The node delete process has been performed.'));
  }
}