You are here

public function AuditTrackEntities::batchFinished in Acquia Content Hub 8.2

Batch finish callback.

This will inspect the results of the batch and will display a message to indicate how the batch process ended.

Parameters

bool $success: The result of batch process.

array $results: The result of $context.

array $operations: The operations that were run.

File

src/AuditTrackEntities.php, line 135

Class

AuditTrackEntities
Audit Pub/Sub track entities.

Namespace

Drupal\acquia_contenthub

Code

public function batchFinished(bool $success, array $results, array $operations) {
  if ($success) {
    $msg = dt('Total number of audited entities not found in Content Hub: @total' . PHP_EOL, [
      '@total' => $results['not_published'],
    ]);
    $msg .= dt('Total number of audited entities found outdated in Content Hub: @total', [
      '@total' => $results['outdated'],
    ]);
  }
  else {
    $msg = dt('Finished with a PHP fatal error.');
  }
  \Drupal::messenger()
    ->addStatus($msg);
}