Projet

Général

Profil

Paste
Télécharger (1,74 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / i18n / i18n.install @ d719f12f

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 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
 */
36
function i18n_install_create_fields($table, $fields, $force_rebuild_schema = FALSE) {
37
  static $schema;
38
  $rebuild_schema = !isset($schema) || $force_rebuild_schema;
39
  $schema = drupal_get_schema($table, $rebuild_schema);
40
  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
}