You are here

public function SitemapWarmer::buildIdsBatch in Warmer 2.x

Same name and namespace in other branches
  1. 8 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 99

Class

SitemapWarmer
The cache warmer for the built-in entity cache.

Namespace

Drupal\warmer_cdn\Plugin\warmer

Code

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());
}