You are here

public function BatchService::warmUpFileFinished in Image Style Warmer 8

Batch Finished callback.

Parameters

bool $success: Success of the operation.

array $results: Array of results for post processing.

array $operations: Array of operations.

File

src/BatchService.php, line 48

Class

BatchService
Class BatchService

Namespace

Drupal\image_style_warmer

Code

public function warmUpFileFinished($success, array $results, array $operations) {
  $messenger = \Drupal::messenger();
  if ($success) {
    $messenger
      ->addMessage(t('@count files warmed up.', [
      '@count' => count($results),
    ]));
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $messenger
      ->addMessage(t('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}