You are here

public function ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchAddCreateBatch in Audit Files 8.3

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

Creates the batch for adding files to the file_usage table.

Parameters

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

Return value

array The definition of the batch.

File

src/ServiceAuditFilesReferencedNotUsed.php, line 223

Class

ServiceAuditFilesReferencedNotUsed
List all methods used in referenced not used functionality.

Namespace

Drupal\auditfiles

Code

public function auditfilesReferencedNotUsedBatchAddCreateBatch(array $referenceids) {
  $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('Adding files to the file_usage table');
  $operations = [];
  foreach ($referenceids as $reference_id) {
    if (!empty($reference_id)) {
      $operations[] = [
        '\\Drupal\\auditfiles\\Batch\\AuditFilesReferencedNotUsedBatchProcess::auditfilesReferencedNotUsedBatchAddProcessBatch',
        [
          $reference_id,
        ],
      ];
    }
  }
  $batch['operations'] = $operations;
  return $batch;
}