public function ServiceAuditFilesNotOnServer::auditfilesNotOnServerBatchDeleteCreateBatch in Audit Files 8.2
Same name and namespace in other branches
- 8.3 src/ServiceAuditFilesNotOnServer.php \Drupal\auditfiles\ServiceAuditFilesNotOnServer::auditfilesNotOnServerBatchDeleteCreateBatch()
- 4.x 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 173
Class
- ServiceAuditFilesNotOnServer
- Providing the service that used in not in database functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesNotOnServerBatchDeleteCreateBatch(array $fileids) {
$batch['error_message'] = $this
->t('One or more errors were encountered processing the files.');
$batch['finished'] = '\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesNotOnServerBatchFinishBatch';
$batch['progress_message'] = $this
->t('Completed @current of @total operations.');
$batch['title'] = $this
->t('Deleting files from the database');
$operations = $file_ids = [];
foreach ($fileids as $file_id) {
if ($file_id != 0) {
$file_ids[] = $file_id;
}
}
foreach ($file_ids as $file_id) {
$operations[] = [
'\\Drupal\\auditfiles\\AuditFilesBatchProcess::auditfilesNotOnServerBatchDeleteProcessBatch',
[
$file_id,
],
];
}
$batch['operations'] = $operations;
return $batch;
}