1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Installation file for Internationalization (i18n) module.
|
6
|
*/
|
7
|
|
8
|
|
9
|
/**
|
10
|
* Implements hook_install().
|
11
|
*/
|
12
|
function i18n_install() {
|
13
|
// Set module weight for it to run after core modules
|
14
|
db_query("UPDATE {system} SET weight = 10 WHERE name = 'i18n' AND type = 'module'");
|
15
|
}
|
16
|
|
17
|
/**
|
18
|
* Implements hook_uninstall().
|
19
|
*/
|
20
|
function i18n_uninstall() {
|
21
|
variable_del('i18n_drupal6_update');
|
22
|
}
|
23
|
|
24
|
/**
|
25
|
* Add fields to schema if they don't exist
|
26
|
*/
|
27
|
function i18n_install_create_fields($table, $fields) {
|
28
|
static $schema;
|
29
|
// Do not force schema refresh more than once per request.
|
30
|
$schema = drupal_get_schema($table, !isset($schema));
|
31
|
foreach ($fields as $field) {
|
32
|
if (!empty($schema['fields'][$field])) {
|
33
|
if (!db_field_exists($table, $field)) {
|
34
|
db_add_field($table, $field, $schema['fields'][$field]);
|
35
|
}
|
36
|
else {
|
37
|
// The field exists, make sure field definition is up to date.
|
38
|
db_change_field($table, $field, $field, $schema['fields'][$field]);
|
39
|
}
|
40
|
}
|
41
|
}
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* Mark this as updated so all (renamed) modules know they need to update from D6 version when installing
|
46
|
*/
|
47
|
function i18n_update_7000() {
|
48
|
variable_set('i18n_drupal6_update', TRUE);
|
49
|
variable_del('i18n_selection_mode');
|
50
|
}
|
51
|
|
52
|
/**
|
53
|
* Refresh caches and rebuild menus.
|
54
|
*/
|
55
|
function i18n_update_7001() {
|
56
|
drupal_flush_all_caches();
|
57
|
}
|