function xmlsitemap_install in XML sitemap 7.2
Same name and namespace in other branches
- 8 xmlsitemap.install \xmlsitemap_install()
- 5.2 xmlsitemap/xmlsitemap.install \xmlsitemap_install()
- 5 xmlsitemap.install \xmlsitemap_install()
- 6.2 xmlsitemap.install \xmlsitemap_install()
- 6 xmlsitemap.install \xmlsitemap_install()
- 2.x xmlsitemap.install \xmlsitemap_install()
Implements hook_install().
File
- ./
xmlsitemap.install, line 315 - Install, update and uninstall functions for the xmlsitemap module.
Code
function xmlsitemap_install() {
// Set this module's weight to 1 so xmlsitemap_cron() runs after all other
// xmlsitemap_x_cron() runs.
db_update('system')
->fields(array(
'weight' => 1,
))
->condition('type', 'module')
->condition('name', 'xmlsitemap')
->execute();
// 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_insert('xmlsitemap')
->fields(array(
'type' => 'frontpage',
'id' => 0,
'loc' => '',
'priority' => variable_get('xmlsitemap_frontpage_priority', 1.0),
'changefreq' => variable_get('xmlsitemap_frontpage_changefreq', XMLSITEMAP_FREQUENCY_DAILY),
'language' => LANGUAGE_NONE,
))
->execute();
// Insert the default context sitemap.
$context = array();
db_insert('xmlsitemap_sitemap')
->fields(array(
'smid' => xmlsitemap_sitemap_get_context_hash($context),
'context' => serialize($context),
))
->execute();
// @todo Does the sitemap show up on first install or is it a 404 page?
// Create the link process the queue.
/** @var DrupalReliableQueueInterface $queue */
$queue = DrupalQueue::get('xmlsitemap_link_process', TRUE);
$queue
->createQueue();
}