You are here

public function FancyFileDeleteBatch::finish in Fancy File Delete 2.0.x

Batch finished.

File

src/FancyFileDeleteBatch.php, line 185

Class

FancyFileDeleteBatch
Class FancyFileDeleteBatch.

Namespace

Drupal\fancy_file_delete

Code

public function finish($success, $results, $operations) {
  if ($success) {

    // Reset the cache.
    $this->entityTypeManager
      ->getStorage('file')
      ->resetCache();
    $message = $this->stringTranslation
      ->formatPlural(count($results), 'One file cleansed.', '@count files cleansed.');
  }
  else {
    $message = $this
      ->t('Assimilation was futile!');
  }
  $this->messenger
    ->addMessage($message);
  return new RedirectResponse(Url::fromRoute('fancy_file_delete.info')
    ->toString());
}