public function XmlSitemapGenerator::regenerateBatchGenerateIndex in XML sitemap 2.x
Same name and namespace in other branches
- 8 src/XmlSitemapGenerator.php \Drupal\xmlsitemap\XmlSitemapGenerator::regenerateBatchGenerateIndex()
Batch callback; generate the index page of a sitemap.
Parameters
string $smid: Sitemap id.
array|\ArrayAccess $context: Sitemap context.
Overrides XmlSitemapGeneratorInterface::regenerateBatchGenerateIndex
File
- src/
XmlSitemapGenerator.php, line 457
Class
- XmlSitemapGenerator
- XmlSitemap generator service class.
Namespace
Drupal\xmlsitemapCode
public function regenerateBatchGenerateIndex($smid, &$context) {
$sitemap = xmlsitemap_sitemap_load($smid);
if ($sitemap != NULL && $sitemap
->getChunks() > 1) {
try {
$this
->generateIndex($sitemap);
} catch (\Exception $e) {
// @todo Should this use watchdog_exception()?
$this->logger
->error($e);
}
$context['message'] = $this
->t('Generated sitemap index %sitemap-url.', [
'%sitemap-url' => Url::fromRoute('xmlsitemap.sitemap_xml', [], $sitemap->uri['options'])
->toString(),
]);
}
}