You are here

function xmlsitemap_engines_install in XML sitemap 5

Same name and namespace in other branches
  1. 6.2 xmlsitemap_engines/xmlsitemap_engines.install \xmlsitemap_engines_install()
  2. 6 xmlsitemap_engines/xmlsitemap_engines.install \xmlsitemap_engines_install()
  3. 7.2 xmlsitemap_engines/xmlsitemap_engines.install \xmlsitemap_engines_install()

Implementation of hook_install().

File

xmlsitemap_engines/xmlsitemap_engines.install, line 6

Code

function xmlsitemap_engines_install() {
  if (db_result(db_query("\n    SELECT 1 FROM {system}\n    WHERE type = 'module' AND name = 'gsitemap' AND (status = 1 OR schema_version >= 0)\n  "))) {
    $settings = db_query("SELECT * FROM {variable} WHERE name LIKE 'gsitemap\\_%\\_submit'");
    while ($variable = db_fetch_object($settings)) {
      $ts = strlen('gsitemap_');
      $tl = strpos($variable->name, '_com_submit') === FALSE ? strlen('_submit') : strlen('_com_submit');
      variable_set('xmlsitemap_engines_' . substr($variable->name, $ts, -$tl) . '_submit', unserialize($variable->value));
      variable_del($variable->name);
    }
    $settings = db_query("SELECT * FROM {variable} WHERE name LIKE 'gsitemap\\_%\\_url'");
    while ($variable = db_fetch_object($settings)) {
      $ts = strlen('gsitemap_');
      $tl = strpos($variable->name, '_com_url') === FALSE ? strlen('_url') : strlen('_com_url');
      variable_set('xmlsitemap_engines_' . substr($variable->name, $ts, -$tl) . '_url', unserialize($variable->value));
      variable_del($variable->name);
    }
    $settings = db_query("SELECT * FROM {variable} WHERE name LIKE 'gsitemap\\_%verify%'");
    while ($variable = db_fetch_object($settings)) {
      $ts = strlen('gsitemap_');
      $tl = strpos($variable->name, '_verify');
      $engine = $tl === FALSE ? 'google' : substr($variable->name, $ts, $tl - $ts);
      variable_set("xmlsitemap_engines_{$engine}" . strstr($variable->name, '_verify'), unserialize($variable->value));
      variable_del($variable->name);
    }
  }
}