You are here

function xmlsitemap_engines_update_6196 in XML sitemap 6.2

Update engine-specific variables from 6.x-1.x.

File

xmlsitemap_engines/xmlsitemap_engines.install, line 31
Install, update and uninstall functions for the xmlsitemap_engines module.

Code

function xmlsitemap_engines_update_6196() {
  $engines = array(
    'ask' => 'http://submissions.ask.com/ping?sitemap=[sitemap]',
    'google' => 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]',
    'moreover' => 'http://api.moreover.com/ping?u=[sitemap]',
    'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap=[sitemap]',
    'yahoo' => 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]',
  );
  $custom_urls = array();
  foreach ($engines as $engine => $default_url) {
    if (variable_get("xmlsitemap_engines_{$engine}_url", $default_url) != $default_url) {

      // If the default URL has changed
      unset($engines[$engine]);
      $custom_urls[] = $default_url;
    }
    elseif (!variable_get("xmlsitemap_engines_{$engine}_submit", 0)) {
      unset($engines[$engine]);
    }
  }
  if ($engines) {
    variable_set('xmlsitemap_engines_engines', array_keys($engines));
  }
  if ($custom_urls) {
    variable_set('xmlsitemap_engines_custom_urls', implode("\n", $custom_urls));
  }
  return array();
}