You are here

function xmlsitemap_install in XML sitemap 6.2

Same name and namespace in other branches
  1. 8 xmlsitemap.install \xmlsitemap_install()
  2. 5.2 xmlsitemap/xmlsitemap.install \xmlsitemap_install()
  3. 5 xmlsitemap.install \xmlsitemap_install()
  4. 6 xmlsitemap.install \xmlsitemap_install()
  5. 7.2 xmlsitemap.install \xmlsitemap_install()
  6. 2.x xmlsitemap.install \xmlsitemap_install()

Implements hook_install().

File

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

Code

function xmlsitemap_install() {

  // Add tables.
  drupal_install_schema('xmlsitemap');

  // Set this module's weight to 1 so xmlsitemap_cron() runs after all other
  // xmlsitemap_x_cron() runs.
  db_query("UPDATE {system} SET weight = 1 WHERE type = 'module' AND name = 'xmlsitemap'");

  // Load the module.
  drupal_load('module', 'xmlsitemap');

  // Insert the homepage link into the {xmlsitemap} table so we do not show an
  // empty sitemap after install.
  db_query("INSERT INTO {xmlsitemap} (type, id, loc, priority, changefreq) VALUES ('frontpage', 0, '', %f, %d)", variable_get('xmlsitemap_frontpage_priority', 1.0), variable_get('xmlsitemap_frontpage_changefreq', XMLSITEMAP_FREQUENCY_DAILY));

  // Insert the default context sitemap.
  $context = array();
  db_query("INSERT INTO {xmlsitemap_sitemap} (smid, context) VALUES ('%s', '%s')", xmlsitemap_sitemap_get_context_hash($context), serialize($context));

  // @todo Does the sitemap show up on first install or is it a 404 page?
}