You are here

function _auditfiles_referenced_not_used_batch_delete_create_batch in Audit Files 7.3

Same name and namespace in other branches
  1. 7.4 auditfiles.referencednotused.inc \_auditfiles_referenced_not_used_batch_delete_create_batch()

Creates the batch for deleting file references from their content.

Parameters

array $referenceids: The list of IDs to be processed.

Return value

array The definition of the batch.

1 call to _auditfiles_referenced_not_used_batch_delete_create_batch()
auditfiles_referenced_not_used_form_submit in ./auditfiles.referencednotused.inc
Submit handler for the auditfiles_referenced_not_used_form form.

File

./auditfiles.referencednotused.inc, line 671
Generates report showing files referenced by content, but not in file_usage.

Code

function _auditfiles_referenced_not_used_batch_delete_create_batch(array $referenceids) {
  $batch = _auditfiles_referenced_not_used_batch_set_common_values();
  $batch['title'] = t('Deleting file references from their content');
  $operations = array();

  // Remove all the empty values from the array.
  $reference_ids = array();
  foreach ($referenceids as $reference_id) {
    if ($reference_id != '') {
      $reference_ids[] = $reference_id;
    }
  }

  // Fill in the $operations variable.
  foreach ($reference_ids as $reference_id) {
    $operations[] = array(
      '_auditfiles_referenced_not_used_batch_delete_process_batch',
      array(
        $reference_id,
      ),
    );
  }
  $batch['operations'] = $operations;
  return $batch;
}