You are here

function xmlsitemap_rebuild_clear in XML sitemap 7.2

Clear all sitemap links for given entity types.

Parameters

array $types: An array of link types.

bool $save_custom: A boolean if links with status or priority overridden should not be removed (and hence overridden values not lost).

Return value

int The number of deleted links.

2 calls to xmlsitemap_rebuild_clear()
drush_xmlsitemap_queue_rebuild in ./xmlsitemap.drush.inc
Dump and queue all the sitemap links to be rebuilt in a queue process.
xmlsitemap_rebuild_batch_clear in ./xmlsitemap.generate.inc
Batch callback; clear sitemap links for entites.
1 string reference to 'xmlsitemap_rebuild_clear'
xmlsitemap_hook_info in ./xmlsitemap.module
Implements hook_hook_info().

File

./xmlsitemap.generate.inc, line 580
Sitemap generation and rebuilding functions for the xmlsitemap module.

Code

function xmlsitemap_rebuild_clear(array $types, $save_custom) {

  // Let other modules respond to the rebuild clearing.
  module_invoke_all('xmlsitemap_rebuild_clear', $types, $save_custom);
  $query = db_delete('xmlsitemap');
  $query
    ->condition('type', $types);

  // If we want to save the custom data, make sure to exclude any links
  // that are not using default inclusion or priority.
  if ($save_custom) {
    $query
      ->condition('status_override', 0);
    $query
      ->condition('priority_override', 0);
  }
  return $query
    ->execute();
}