popsu-d7/sites/all/modules/i18n/i18n.install
Bachir Soussi Chiadmi 1bc61b12ad first import
2015-04-08 11:40:19 +02:00

58 lines
1.3 KiB
Plaintext

<?php
/**
* @file
* Installation file for Internationalization (i18n) module.
*/
/**
* Implements hook_install().
*/
function i18n_install() {
// Set module weight for it to run after core modules
db_query("UPDATE {system} SET weight = 10 WHERE name = 'i18n' AND type = 'module'");
}
/**
* Implements hook_uninstall().
*/
function i18n_uninstall() {
variable_del('i18n_drupal6_update');
}
/**
* Add fields to schema if they don't exist
*/
function i18n_install_create_fields($table, $fields) {
static $schema;
// Do not force schema refresh more than once per request.
$schema = drupal_get_schema($table, !isset($schema));
foreach ($fields as $field) {
if (!empty($schema['fields'][$field])) {
if (!db_field_exists($table, $field)) {
db_add_field($table, $field, $schema['fields'][$field]);
}
else {
// The field exists, make sure field definition is up to date.
db_change_field($table, $field, $field, $schema['fields'][$field]);
}
}
}
}
/**
* Mark this as updated so all (renamed) modules know they need to update from D6 version when installing
*/
function i18n_update_7000() {
variable_set('i18n_drupal6_update', TRUE);
variable_del('i18n_selection_mode');
}
/**
* Refresh caches and rebuild menus.
*/
function i18n_update_7001() {
drupal_flush_all_caches();
}