You are here

public function ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchDeleteCreateBatch in Audit Files 8.2

Same name and namespace in other branches
  1. 8.3 src/ServiceAuditFilesReferencedNotUsed.php \Drupal\auditfiles\ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchDeleteCreateBatch()
  2. 4.x src/ServiceAuditFilesReferencedNotUsed.php \Drupal\auditfiles\ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchDeleteCreateBatch()

Creates the batch for deleting file references from their content.

Parameters

array $referenceids: The list of IDs to be processed.

Return value

array The definition of the batch.

File

src/ServiceAuditFilesReferencedNotUsed.php, line 302

Class

ServiceAuditFilesReferencedNotUsed
List all methods used in referenced not used functionality.

Namespace

Drupal\auditfiles

Code

public function auditfilesReferencedNotUsedBatchDeleteCreateBatch(array $referenceids) {
  $batch['error_message'] = $this->stringTranslation
    ->translate('One or more errors were encountered processing the files.');
  $batch['finished'] = '\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesReferencedNotUsedBatchFinishBatch';
  $batch['progress_message'] = $this->stringTranslation
    ->translate('Completed @current of @total operations.');
  $batch['title'] = $this->stringTranslation
    ->translate('Deleting file references from their content');
  $operations = $reference_ids = [];
  foreach ($referenceids as $reference_id) {
    if ($reference_id != '') {
      $reference_ids[] = $reference_id;
    }
  }

  // Fill in the $operations variable.
  foreach ($reference_ids as $reference_id) {
    $operations[] = [
      '\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesReferencedNotUsedBatchDeleteProcessBatch',
      [
        $reference_id,
      ],
    ];
  }
  $batch['operations'] = $operations;
  return $batch;
}