public static function Batch::finishGeneration in Simple XML sitemap 8.2
Callback function called by the batch API when all operations are finished.
Parameters
$success:
$results:
$operations:
See also
https://api.drupal.org/api/drupal/core!includes!form.inc/group/batch/8
1 call to Batch::finishGeneration()
- Batch::start in src/
Batch.php - Starts the batch process depending on where it was requested from.
File
- src/
Batch.php, line 146
Class
- Batch
- Class Batch @package Drupal\simple_sitemap\Batch
Namespace
Drupal\simple_sitemapCode
public static function finishGeneration($success, $results, $operations) {
if ($success) {
$remove_sitemap = empty($results['chunk_count']);
if (!empty($results['generate']) || $remove_sitemap) {
\Drupal::service('simple_sitemap.sitemap_generator')
->setSettings([
'excluded_languages' => \Drupal::service('simple_sitemap.generator')
->getSetting('excluded_languages', []),
])
->generateSitemap(!empty($results['generate']) ? $results['generate'] : [], $remove_sitemap);
}
Cache::invalidateTags([
'simple_sitemap',
]);
\Drupal::service('simple_sitemap.logger')
->m(self::REGENERATION_FINISHED_MESSAGE, [
'@url' => $GLOBALS['base_url'] . '/sitemap.xml',
])
->display('status')
->log('info');
}
else {
\Drupal::service('simple_sitemap.logger')
->m(self::REGENERATION_FINISHED_ERROR_MESSAGE)
->display('error', 'administer sitemap settings')
->log('error');
}
}