You are here

protected function Simplesitemap::fetchSitemapVariantInfo in Simple XML sitemap 8.3

Fetches info about all published sitemap variants and their chunks.

Return value

array An array containing all published sitemap chunk IDs, deltas and creation timestamps keyed by the currently set variants, or in case of only one variant set the above keyed by sitemap delta.

1 call to Simplesitemap::fetchSitemapVariantInfo()
Simplesitemap::getSitemap in src/Simplesitemap.php
Returns a sitemap variant, its index, or its requested chunk.

File

src/Simplesitemap.php, line 290

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

protected function fetchSitemapVariantInfo() {
  if (!empty($this
    ->getVariants())) {
    $result = $this->db
      ->select('simple_sitemap', 's')
      ->fields('s', [
      'id',
      'delta',
      'sitemap_created',
      'type',
    ])
      ->condition('s.status', 1)
      ->condition('s.type', $this
      ->getVariants(), 'IN')
      ->execute();
    return count($this
      ->getVariants()) > 1 ? $result
      ->fetchAllAssoc('type') : $result
      ->fetchAllAssoc('delta');
  }
  return [];
}