You are here

function xmlsitemap_install in XML sitemap 5.2

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

Implementation of hook_install().

File

xmlsitemap/xmlsitemap.install, line 22
Install file for XML sitemap

Code

function xmlsitemap_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {xmlsitemap} (\n        loc varchar(255) NOT NULL default '',\n        lastmod int(11),\n        changefreq int(11),\n        priority float\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {xmlsitemap} (\n        loc varchar(255) NOT NULL default '',\n        lastmod integer,\n        changefreq integer,\n        priority real\n      );");
      db_query('CREATE OR REPLACE FUNCTION first(anyelement, anyelement) RETURNS anyelement AS \'SELECT COALESCE($1, $2);\' LANGUAGE \'sql\';');
      @db_query("DROP AGGREGATE first(anyelement)");
      db_query("CREATE AGGREGATE first(\n        sfunc = first,\n        basetype = anyelement,\n        stype = anyelement\n      );");
      break;
  }
  db_query("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'");
}