You are here

function _xmlsitemap_sitemap_rehash_all in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap.install \_xmlsitemap_sitemap_rehash_all()

Rehash all.

3 calls to _xmlsitemap_sitemap_rehash_all()
xmlsitemap_update_6204 in ./xmlsitemap.install
Convert {xmlsitemap}.context_hash to replace {xmlsitemap}.smid.
xmlsitemap_update_7203 in ./xmlsitemap.install
Convert {xmlsitemap}.context_hash to replace {xmlsitemap}.smid.
xmlsitemap_update_7204 in ./xmlsitemap.install
Rehash all sitemaps according to new context sorting.

File

./xmlsitemap.install, line 581
Install, update and uninstall functions for the xmlsitemap module.

Code

function _xmlsitemap_sitemap_rehash_all() {

  // Reload the schema cache and reprocess all sitemap hashes into smids.
  drupal_load('module', 'xmlsitemap');
  drupal_get_schema(NULL, TRUE);

  // Force a rehash of all sitemaps.
  $sitemaps = xmlsitemap_sitemap_load_multiple(FALSE);
  foreach ($sitemaps as $sitemap) {
    $hash = xmlsitemap_sitemap_get_context_hash($sitemap->context);
    if ($hash != $sitemap->smid) {
      xmlsitemap_sitemap_save($sitemap);
    }
  }
}