geoip_language.install in GeoIP API 6
Same filename and directory in other branches
file_description
File
geoip_language/geoip_language.installView source
<?php
/**
* @file
* file_description
*/
/**
* Implementation of hook_schema().
*/
function geoip_language_schema() {
$schema['geoip_language'] = array(
'description' => 'Table to store geoip country to language mappings.',
'fields' => array(
'country' => array(
'type' => 'char',
'length' => 2,
'not null' => TRUE,
'description' => 'Country code, as defined in http://www.maxmind.com/app/iso3166.',
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => 'Language code, as defined in the languages table.',
),
),
'primary key' => array(
'country',
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function geoip_language_install() {
drupal_install_schema('geoip_language');
// Make sure this module loads before most "normal" modules. This allows the
// language negotiation to happen in hook_init() rather than hook_boot().
db_query("UPDATE {system} SET weight = -1 WHERE name = 'geoip_language'");
}
/**
* Implementation of hook_uninstall().
*/
function geoip_language_uninstall() {
drupal_uninstall_schema('geoip_language');
}
Functions
Name | Description |
---|---|
geoip_language_install | Implementation of hook_install(). |
geoip_language_schema | Implementation of hook_schema(). |
geoip_language_uninstall | Implementation of hook_uninstall(). |