You are here

public function XmlSitemapGenerator::rebuildBatchFinished in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 src/XmlSitemapGenerator.php \Drupal\xmlsitemap\XmlSitemapGenerator::rebuildBatchFinished()

Batch callback; sitemap rebuild finished.

Parameters

bool $success: Checks if regeneration batch process was successful.

array $results: Results for the regeneration process.

array $operations: Operations performed.

int $elapsed: Elapsed. Time elapsed.

Overrides XmlSitemapGeneratorInterface::rebuildBatchFinished

File

src/XmlSitemapGenerator.php, line 582

Class

XmlSitemapGenerator
XmlSitemap generator service class.

Namespace

Drupal\xmlsitemap

Code

public function rebuildBatchFinished($success, array $results, array $operations, $elapsed) {
  if ($success && !$this->state
    ->get('xmlsitemap_rebuild_needed', FALSE)) {
    $this->messenger
      ->addStatus($this
      ->t('The sitemap links were rebuilt.'));
  }
  else {
    $this->messenger
      ->addError($this
      ->t('The sitemap links were not successfully rebuilt.'));
  }
}