You are here

function xmlsitemap_engines_cron in XML sitemap 6

Same name and namespace in other branches
  1. 8 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_cron()
  2. 6.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_cron()
  3. 7.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_cron()
  4. 2.x xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_cron()

Implementation of hook_cron().

File

xmlsitemap_engines/xmlsitemap_engines.module, line 20
Define actions for Google, Yahoo!, Ask, and Bing.

Code

function xmlsitemap_engines_cron() {
  if (variable_get('site_offline', 0)) {
    return;
  }
  $frequency = variable_get('xmlsitemap_engines_cron_submit_frequency', 3600);
  $last_ping = variable_get('xmlsitemap_engines_cron_timestamp_submit', 0);
  $submit_on_change = variable_get('xmlsitemap_engines_submit', FALSE);
  $content_changed = variable_get('xmlsitemap_sitemap_is_changed', FALSE);
  $ping_engines = (!$submit_on_change || $content_changed) && REQUEST_TIME - $last_ping >= $frequency;
  if ($ping_engines) {
    xmlsitemap_engines_ping_sitemap();
    variable_set('xmlsitemap_sitemap_is_changed', FALSE);
    variable_set('xmlsitemap_engines_cron_timestamp_submit', REQUEST_TIME);
  }
}