public function SitemapWarmer::buildIdsBatch in Warmer 8
Same name and namespace in other branches
- 2.x modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php \Drupal\warmer_cdn\Plugin\warmer\SitemapWarmer::buildIdsBatch()
Builds the next batch of IDs based on a position cursor.
Parameters
mixed $cursor: The position of the last generate batch.
Return value
array The array of item IDs.
Overrides WarmerInterface::buildIdsBatch
File
- modules/
warmer_cdn/ src/ Plugin/ warmer/ SitemapWarmer.php, line 100
Class
- SitemapWarmer
- The cache warmer for the built-in entity cache.
Namespace
Drupal\warmer_cdn\Plugin\warmerCode
public function buildIdsBatch($cursor) {
// Parse the sitemaps and extract the URLs.
$urls = $this
->parseSitemaps();
$cursor_position = is_null($cursor) ? -1 : array_search($cursor, $urls);
if ($cursor_position === FALSE) {
return [];
}
return array_slice($urls, $cursor_position + 1, (int) $this
->getBatchSize());
}