1 |
85ad3d82
|
Assos Assos
|
<?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 |
6331c987
|
Assos Assos
|
* Add fields to the schema if they don't exist.
|
26 |
|
|
*
|
27 |
|
|
* @param string $table
|
28 |
|
|
* The name of the database table.
|
29 |
|
|
* @param array $fields
|
30 |
|
|
* The list of database fields to create.
|
31 |
|
|
* @param boolean $force_rebuild_schema
|
32 |
|
|
* Whether to force drupal_get_schema() to rebuild the schema. This may be
|
33 |
|
|
* necessary when additional implementations of hook_schema_alter() have
|
34 |
|
|
* become available since the schema was originally built.
|
35 |
85ad3d82
|
Assos Assos
|
*/
|
36 |
6331c987
|
Assos Assos
|
function i18n_install_create_fields($table, $fields, $force_rebuild_schema = FALSE) {
|
37 |
85ad3d82
|
Assos Assos
|
static $schema;
|
38 |
6331c987
|
Assos Assos
|
$rebuild_schema = !isset($schema) || $force_rebuild_schema;
|
39 |
|
|
$schema = drupal_get_schema($table, $rebuild_schema);
|
40 |
85ad3d82
|
Assos Assos
|
foreach ($fields as $field) {
|
41 |
|
|
if (!empty($schema['fields'][$field])) {
|
42 |
|
|
if (!db_field_exists($table, $field)) {
|
43 |
|
|
db_add_field($table, $field, $schema['fields'][$field]);
|
44 |
|
|
}
|
45 |
|
|
else {
|
46 |
|
|
// The field exists, make sure field definition is up to date.
|
47 |
|
|
db_change_field($table, $field, $field, $schema['fields'][$field]);
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
/**
|
54 |
|
|
* Mark this as updated so all (renamed) modules know they need to update from D6 version when installing
|
55 |
|
|
*/
|
56 |
|
|
function i18n_update_7000() {
|
57 |
|
|
variable_set('i18n_drupal6_update', TRUE);
|
58 |
|
|
variable_del('i18n_selection_mode');
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
/**
|
62 |
|
|
* Refresh caches and rebuild menus.
|
63 |
|
|
*/
|
64 |
|
|
function i18n_update_7001() {
|
65 |
|
|
drupal_flush_all_caches();
|
66 |
|
|
} |