You are here

public static function SitemapGeneratorBase::purgeSitemapVariants in Simple XML sitemap 8.3

2 calls to SitemapGeneratorBase::purgeSitemapVariants()
QueueWorker::deleteQueue in src/Queue/QueueWorker.php
SitemapGeneratorBase::remove in src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php

File

src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php, line 195

Class

SitemapGeneratorBase
Class SitemapGeneratorBase @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator

Code

public static function purgeSitemapVariants($variants = NULL, $mode = 'all') {
  if (NULL === $variants || !empty((array) $variants)) {
    $delete_query = \Drupal::database()
      ->delete('simple_sitemap');
    switch ($mode) {
      case 'published':
        $delete_query
          ->condition('status', 1);
        break;
      case 'unpublished':
        $delete_query
          ->condition('status', 0);
        break;
      case 'all':
        break;
      default:
    }
    if (NULL !== $variants) {
      $delete_query
        ->condition('type', (array) $variants, 'IN');
    }
    $delete_query
      ->execute();
  }
}