You are here

function _auditfiles_not_in_database_batch_delete_create_batch in Audit Files 7.3

Same name and namespace in other branches
  1. 7.4 auditfiles.notindatabase.inc \_auditfiles_not_in_database_batch_delete_create_batch()

Creates the batch for deleting files from the server.

Parameters

array $file_names: The list of file names to be processed.

Return value

array The definition of the batch.

1 call to _auditfiles_not_in_database_batch_delete_create_batch()
auditfiles_not_in_database_form_submit in ./auditfiles.notindatabase.inc
Submit handler for the auditfiles_not_in_database_form form.

File

./auditfiles.notindatabase.inc, line 618
Generates a report showing files on the server, but not in the database.

Code

function _auditfiles_not_in_database_batch_delete_create_batch(array $file_names) {
  $batch = _auditfiles_not_in_database_batch_set_common_values();
  $batch['title'] = t('Deleting files from the server');
  $operations = array();

  // Remove all the empty values from the array.
  $filenames = array();
  foreach ($file_names as $file_name) {
    if (!empty($file_name)) {
      $filenames[] = $file_name;
    }
  }

  // Fill in the $operations variable.
  foreach ($filenames as $filename) {
    $operations[] = array(
      '_auditfiles_not_in_database_batch_delete_process_batch',
      array(
        $filename,
      ),
    );
  }
  $batch['operations'] = $operations;
  return $batch;
}