You are here

function _auditfiles_not_in_database_batch_add_create_batch in Audit Files 7.4

Same name and namespace in other branches
  1. 7.3 auditfiles.notindatabase.inc \_auditfiles_not_in_database_batch_add_create_batch()

Creates the batch for adding files to the database.

Parameters

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

Return value

array The definition of the batch.

1 call to _auditfiles_not_in_database_batch_add_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 471
Generates a report showing files on the server, but not in the database.

Code

function _auditfiles_not_in_database_batch_add_create_batch(array $fileids) {
  $batch = _auditfiles_not_in_database_batch_set_common_values();
  $batch['title'] = t('Adding files to Drupal file management');
  $operations = array();

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

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