public function ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchAddCreateBatch in Audit Files 8.2
Same name and namespace in other branches
- 8.3 src/ServiceAuditFilesReferencedNotUsed.php \Drupal\auditfiles\ServiceAuditFilesReferencedNotUsed::auditfilesReferencedNotUsedBatchAddCreateBatch()
- 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\auditfilesCode
public function auditfilesReferencedNotUsedBatchAddCreateBatch(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('Adding files to the file_usage table');
$operations = $reference_ids = [];
foreach ($referenceids as $reference_id) {
if (!empty($reference_id)) {
$reference_ids[] = $reference_id;
}
}
foreach ($reference_ids as $reference_id) {
$operations[] = [
'\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesReferencedNotUsedBatchAddProcessBatch',
[
$reference_id,
],
];
}
$batch['operations'] = $operations;
return $batch;
}