1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Install, update and uninstall functions for the text module.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Implements hook_install().
|
10 |
|
|
*/
|
11 |
|
|
function i18n_path_install() {
|
12 |
|
|
// Set module weight for it to run after core modules, but before views.
|
13 |
|
|
db_update('system')
|
14 |
|
|
->fields(array('weight' => 5))
|
15 |
|
|
->condition('name', 'i18n_path', '=')
|
16 |
|
|
->condition('type', 'module', '=')
|
17 |
|
|
->execute();
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
/**
|
21 |
|
|
* Implements hook_schema().
|
22 |
|
|
*/
|
23 |
|
|
function i18n_path_schema() {
|
24 |
|
|
$schema['i18n_path'] = array(
|
25 |
|
|
'description' => 'Path translation',
|
26 |
|
|
'fields' => array(
|
27 |
|
|
'tpid' => array(
|
28 |
|
|
'description' => 'The primary identifier for a path in the translation set.',
|
29 |
|
|
'type' => 'serial',
|
30 |
|
|
'unsigned' => TRUE,
|
31 |
|
|
'not null' => TRUE,
|
32 |
|
|
),
|
33 |
|
|
'tsid' => array(
|
34 |
|
|
'description' => 'The primary identifier for a translation set.',
|
35 |
|
|
'type' => 'int',
|
36 |
|
|
'unsigned' => TRUE,
|
37 |
|
|
'not null' => TRUE,
|
38 |
|
|
),
|
39 |
|
|
'path' => array(
|
40 |
|
|
'description' => 'The Drupal path this alias is for; e.g. node/12.',
|
41 |
|
|
'type' => 'varchar',
|
42 |
|
|
'length' => 255,
|
43 |
|
|
'not null' => TRUE,
|
44 |
|
|
'default' => '',
|
45 |
|
|
),
|
46 |
|
|
'language' => array(
|
47 |
|
|
'description' => "The language for which this path is a translation.",
|
48 |
|
|
'type' => 'varchar',
|
49 |
|
|
'length' => 12,
|
50 |
|
|
'not null' => TRUE,
|
51 |
|
|
'default' => '',
|
52 |
|
|
),
|
53 |
|
|
'pid' => array(
|
54 |
|
|
'description' => 'A unique path alias identifier if the path has an alias.',
|
55 |
|
|
'type' => 'int',
|
56 |
|
|
'unsigned' => TRUE,
|
57 |
|
|
'not null' => TRUE,
|
58 |
|
|
'default' => 0,
|
59 |
|
|
),
|
60 |
|
|
),
|
61 |
|
|
'indexes' => array(
|
62 |
|
|
'path' => array('path'),
|
63 |
|
|
),
|
64 |
|
|
'unique keys' => array(
|
65 |
|
|
'set_language' => array('tsid', 'language'),
|
66 |
|
|
),
|
67 |
|
|
'foreign keys' => array(
|
68 |
|
|
'path_language' => array(
|
69 |
|
|
'table' => 'languages',
|
70 |
|
|
'columns' => array('language' => 'language'),
|
71 |
|
|
),
|
72 |
|
|
'translation_set' => array(
|
73 |
|
|
'table' => 'i18n_translation',
|
74 |
|
|
'columns' => array('tsid' => 'tsid'),
|
75 |
|
|
),
|
76 |
|
|
),
|
77 |
|
|
'primary key' => array('tpid'),
|
78 |
|
|
);
|
79 |
|
|
return $schema;
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
/**
|
83 |
|
|
* Set module weight.
|
84 |
|
|
*/
|
85 |
|
|
function i18n_path_update_7000(&$sandbox) {
|
86 |
|
|
// Set module weight for it to run after core modules, but before views.
|
87 |
|
|
db_update('system')
|
88 |
|
|
->fields(array('weight' => 5))
|
89 |
|
|
->condition('name', 'i18n_path', '=')
|
90 |
|
|
->condition('type', 'module', '=')
|
91 |
|
|
->execute();
|
92 |
|
|
} |