function _security_review_batch_run_finished in Security Review 8
Callback for finishing the batch job of running the checklist.
Parameters
bool $success: Whether the batch job was successful.
\Drupal\security_review\CheckResult[] $results: The results of the batch job.
array $operations: The array of batch operations.
1 string reference to '_security_review_batch_run_finished'
- RunForm::submitForm in src/
Form/ RunForm.php - Form submission handler.
File
- ./
security_review.module, line 202 - Site security review and reporting Drupal module.
Code
function _security_review_batch_run_finished($success, array $results, array $operations) {
/** @var \Drupal\security_review\SecurityReview $security_review */
$security_review = Drupal::service('security_review');
/** @var \Drupal\security_review\Checklist $checklist */
$checklist = Drupal::service('security_review.checklist');
$security_review
->setLastRun(time());
if ($success) {
if (!empty($results)) {
$checklist
->storeResults($results);
}
\Drupal::messenger()
->addMessage(t('Review complete'));
}
else {
// Show error information.
$error_operation = reset($operations);
$message = t('An error occurred while processing %error_operation with arguments: @arguments', [
'%error_operation' => $error_operation[0],
'@arguments' => print_r($error_operation[1], TRUE),
]);
$security_review
->log(NULL, $message, [], RfcLogLevel::ERROR);
\Drupal::messenger()
->addMessage(t('The review did not store all results, please run again or check the logs for details.'));
}
}