You are here

public static function S3fsFileMigrationBatch::finished in S3 File System 8.3

Same name and namespace in other branches
  1. 4.0.x src/Batch/S3fsFileMigrationBatch.php \Drupal\s3fs\Batch\S3fsFileMigrationBatch::finished()

Finished batch callback.

Parameters

bool $success: Whether the batch completed successfully or not.

array $results: The results key of the batch context.

array $operations: The operations that were carried out.

Overrides S3fsFileMigrationBatchInterface::finished

File

src/Batch/S3fsFileMigrationBatch.php, line 258

Class

S3fsFileMigrationBatch
Batch migrate files to a S3 bucket.

Namespace

Drupal\s3fs\Batch

Code

public static function finished($success, array $results, array $operations) {
  $msgText = new TranslatableMarkup('Copied local %scheme files to S3 in @elapsed_time (hh:mm:ss).', [
    '%scheme' => $results['scheme'],
    '@elapsed_time' => static::getElapsedTimeFormatted($results['time_start']),
  ]);
  if (!empty($results['errors'])) {
    $msgText .= '<br>' . new TranslatableMarkup("The following errors occurred:");
    foreach ($results['errors'] as $error) {
      $msgText .= '<br>' . $error;
    }
  }
  \Drupal::messenger()
    ->addStatus(new FormattableMarkup($msgText, []));
}