function finishContentExportBatch in Content Synchronization 8
Finish batch.
Provide information about the Content Batch results.
1 string reference to 'finishContentExportBatch'
- ContentExportForm::submitForm in src/
Form/ ContentExportForm.php - Form submission handler.
File
- ./
content_sync.batch.inc, line 561
Code
function finishContentExportBatch($success, $results, $operations) {
if ($success) {
$errors = $results['errors'];
unset($results['errors']);
$results = array_unique($results);
// Log all the items processed
foreach ($results as $key => $result) {
if ($key != 'errors') {
//drupal_set_message(t('Processed UUID @title.', array('@title' => $result)));
\Drupal::logger('content_sync')
->info('Processed UUID @title.', [
'@title' => $result,
'link' => 'Export',
]);
}
}
if (!empty($errors)) {
// Log the errors
$errors = array_unique($errors);
foreach ($errors as $error) {
//drupal_set_message($error, 'error');
\Drupal::logger('content_sync')
->error($error);
}
// Log the note that the content was exported with errors.
drupal_set_message(\Drupal::translation()
->translate('The content was exported with errors. <a href=":content-overview">Logs</a>', [
':content-overview' => \Drupal::url('content.overview'),
]), 'warning');
\Drupal::logger('content_sync')
->warning('The content was exported with errors.', [
'link' => 'Export',
]);
}
else {
// Log the new created export link if applicable.
drupal_set_message(\Drupal::translation()
->translate('The content was exported successfully. <a href=":export-download">Download tar file</a>', [
':export-download' => \Drupal::url('content.export_download'),
]));
\Drupal::logger('content_sync')
->info('The content was exported successfully. <a href=":export-download">Download tar file</a>', [
':export-download' => \Drupal::url('content.export_download'),
'link' => 'Export',
]);
}
}
else {
// Log that there was an error
$message = t('Finished with an error.<a href=":content-overview">Logs</a>', [
':content-overview' => \Drupal::url('content.overview'),
]);
drupal_set_message($message);
\Drupal::logger('content_sync')
->error('Finished with an error.', [
'link' => 'Export',
]);
}
}