public function ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedBatchDeleteCreateBatch in Audit Files 8.2
Same name and namespace in other branches
- 8.3 src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedBatchDeleteCreateBatch()
- 4.x src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedBatchDeleteCreateBatch()
Creates the batch for deleting files from the file_usage table.
File
- src/
ServiceAuditFilesUsedNotManaged.php, line 118
Class
- ServiceAuditFilesUsedNotManaged
- Form for Files used not managed functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesUsedNotManagedBatchDeleteCreateBatch(array $fileids) {
$batch['error_message'] = $this
->t('One or more errors were encountered processing the files.');
$batch['finished'] = '\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesUsedNotManagedBatchFinishBatch';
$batch['progress_message'] = $this
->t('Completed @current of @total operations.');
$batch['title'] = $this
->t('Deleting files from the file_usage table');
$operations = $file_ids = [];
foreach ($fileids as $file_id) {
if ($file_id != 0) {
$file_ids[] = $file_id;
}
}
// Fill in the $operations variable.
foreach ($file_ids as $file_id) {
$operations[] = [
'\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesUsedNotManagedBatchDeleteProcessBatch',
[
$file_id,
],
];
}
$batch['operations'] = $operations;
return $batch;
}