You are here

function xmlsitemap_load_all_includes in XML sitemap 6.2

Load all modulename.xmlsitemap.inc files.

Instead of blindly running on all modules like module_load_all_includes(), this function will cache which modules actually have those files, which benefits performance.

11 calls to xmlsitemap_load_all_includes()
xmlsitemap_generate_chunk in ./xmlsitemap.generate.inc
xmlsitemap_generate_index in ./xmlsitemap.generate.inc
Generate the index sitemap.
xmlsitemap_generate_page in ./xmlsitemap.generate.inc
Generate one page (chunk) of the sitemap.
xmlsitemap_get_context_info in ./xmlsitemap.module
xmlsitemap_get_current_context in ./xmlsitemap.module
Get the sitemap context of the current request.

... See full list

File

./xmlsitemap.module, line 1544
Main file for the xmlsitemap module.

Code

function xmlsitemap_load_all_includes() {
  $modules =& xmlsitemap_static(__FUNCTION__);
  if (!isset($modules)) {
    if ($cache = cache_get('xmlsitemap:registry:xmlsitemap.inc')) {
      $modules = $cache->data;
    }
    else {
      $modules = module_list();
    }
    foreach ($modules as $index => $module) {
      if (module_load_include('xmlsitemap.inc', $module) === FALSE) {

        // If the module.xmlsitemap.inc file does not exist, remove it from
        // the registry.
        unset($modules[$index]);
      }
    }
    if (!$cache) {
      cache_set('xmlsitemap:registry:xmlsitemap.inc', $modules);
    }
  }
}