public function CdnWarmer::buildIdsBatch in Warmer 2.x
Same name and namespace in other branches
- 8 modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php \Drupal\warmer_cdn\Plugin\warmer\CdnWarmer::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/ CdnWarmer.php, line 114
Class
- CdnWarmer
- 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.
$config = $this
->getConfiguration();
$urls = empty($config['urls']) ? [] : $config['urls'];
$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());
}