You are here

function _auditfiles_referenced_not_used_batch_add_create_batch in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.referencednotused.inc \_auditfiles_referenced_not_used_batch_add_create_batch()

Creates the batch for adding files to the file_usage table.

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_add_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 458
Generates report showing files referenced by content, but not in file_usage.

Code

function _auditfiles_referenced_not_used_batch_add_create_batch(array $referenceids) {
  $batch = _auditfiles_referenced_not_used_batch_set_common_values();
  $batch['title'] = t('Adding files to the file_usage table');
  $operations = array();

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

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