You are here

function _auditfiles_used_not_managed_batch_delete_create_batch in Audit Files 7.3

Same name and namespace in other branches
  1. 7.4 auditfiles.usednotmanaged.inc \_auditfiles_used_not_managed_batch_delete_create_batch()

Creates the batch for deleting files from the file_usage table.

Parameters

array $fileids: The list of file IDs to be processed.

Return value

array The definition of the batch.

1 call to _auditfiles_used_not_managed_batch_delete_create_batch()
auditfiles_used_not_managed_form_submit in ./auditfiles.usednotmanaged.inc
Submit handler for the auditfiles_used_not_managed_form form.

File

./auditfiles.usednotmanaged.inc, line 448
Generates a report showing files in file_usage, but not in file_managed.

Code

function _auditfiles_used_not_managed_batch_delete_create_batch(array $fileids) {
  $batch = _auditfiles_used_not_managed_batch_set_common_values();
  $batch['title'] = t('Deleting files from the file_usage table');
  $operations = array();

  // Remove all the empty values from the array.
  $file_ids = array();
  foreach ($fileids as $file_id) {
    if ($file_id != 0) {
      $file_ids[] = $file_id;
    }
  }

  // Fill in the $operations variable.
  foreach ($file_ids as $file_id) {
    $operations[] = array(
      '_auditfiles_used_not_managed_batch_delete_process_batch',
      array(
        $file_id,
      ),
    );
  }
  $batch['operations'] = $operations;
  return $batch;
}