You are here

public function ServiceAuditFilesNotOnServer::auditfilesNotOnServerBatchDeleteCreateBatch in Audit Files 4.x

Same name and namespace in other branches
  1. 8.3 src/ServiceAuditFilesNotOnServer.php \Drupal\auditfiles\ServiceAuditFilesNotOnServer::auditfilesNotOnServerBatchDeleteCreateBatch()
  2. 8.2 src/ServiceAuditFilesNotOnServer.php \Drupal\auditfiles\ServiceAuditFilesNotOnServer::auditfilesNotOnServerBatchDeleteCreateBatch()

Creates the batch for deleting files from the database.

Parameters

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

Return value

array The definition of the batch.

File

src/ServiceAuditFilesNotOnServer.php, line 178

Class

ServiceAuditFilesNotOnServer
Providing the service that used in not in database functionality.

Namespace

Drupal\auditfiles

Code

public function auditfilesNotOnServerBatchDeleteCreateBatch(array $fileids) {
  $batch['error_message'] = $this->stringTranslation
    ->translate('One or more errors were encountered processing the files.');
  $batch['finished'] = '\\Drupal\\auditfiles\\Batch\\AuditFilesBatchProcess::finishBatch';
  $batch['progress_message'] = $this->stringTranslation
    ->translate('Completed @current of @total operations.');
  $batch['title'] = $this->stringTranslation
    ->translate('Deleting files from the database');
  $operations = [];
  foreach ($fileids as $file_id) {
    if ($file_id != 0) {
      $operations[] = [
        '\\Drupal\\auditfiles\\Batch\\AuditFilesNotOnServerBatchProcess::auditfilesNotOnServerBatchDeleteProcessBatch',
        [
          $file_id,
        ],
      ];
    }
  }
  $batch['operations'] = $operations;
  return $batch;
}