public function ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseBatchAddCreateBatch in Audit Files 8.3
Same name and namespace in other branches
- 8.2 src/ServiceAuditFilesNotInDatabase.php \Drupal\auditfiles\ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseBatchAddCreateBatch()
- 4.x src/ServiceAuditFilesNotInDatabase.php \Drupal\auditfiles\ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseBatchAddCreateBatch()
Creates the batch for adding files to the database.
Parameters
array $fileids: The list of file IDs to be processed.
Return value
array The definition of the batch.
File
- src/
ServiceAuditFilesNotInDatabase.php, line 415
Class
- ServiceAuditFilesNotInDatabase
- Define all methods that are used on Files not in database functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesNotInDatabaseBatchAddCreateBatch(array $fileids) {
$batch['title'] = $this->stringTranslation
->translate('Adding files to Drupal file management');
$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.');
$operations = [];
foreach ($fileids as $file_id) {
if (!empty($file_id)) {
$operations[] = [
"\\Drupal\\auditfiles\\Batch\\AuditFilesNotInDatabaseBatchProcess::auditfilesNotInDatabaseBatchAddProcessBatch",
[
$file_id,
],
];
}
}
$batch['operations'] = $operations;
return $batch;
}