You are here

function ServiceAuditFilesManagedNotUsed::_auditfiles_managed_not_used_batch_delete_create_batch in Audit Files 8

Batch process

File

src/ServiceAuditFilesManagedNotUsed.php, line 100
providing the service that used in 'managed not used' functionality.

Class

ServiceAuditFilesManagedNotUsed

Namespace

Drupal\auditfiles

Code

function _auditfiles_managed_not_used_batch_delete_create_batch(array $fileids) {
  $batch['error_message'] = t('One or more errors were encountered processing the files.');
  $batch['finished'] = '\\Drupal\\auditfiles\\AuditFilesBatchProcess::_auditfiles_managed_not_used_batch_finish_batch';
  $batch['progress_message'] = t('Completed @current of @total operations.');
  $batch['title'] = t('Deleting files from the file_managed table');
  $operations = $file_ids = [];
  foreach ($fileids as $file_id) {
    if ($file_id != 0) {
      $file_ids[] = $file_id;
    }
  }
  foreach ($file_ids as $file_id) {
    $operations[] = [
      '\\Drupal\\auditfiles\\AuditFilesBatchProcess::_auditfiles_managed_not_used_batch_delete_process_batch',
      [
        $file_id,
      ],
    ];
  }
  $batch['operations'] = $operations;
  return $batch;
}