Révision 4eeb3b46
Ajouté par Assos Assos il y a presque 8 ans
drupal7/sites/all/modules/uuid/uuid.install | ||
---|---|---|
31 | 31 |
/** |
32 | 32 |
* Implements hook_schema_alter(). |
33 | 33 |
*/ |
34 |
function uuid_schema_alter(&$schema = array()) { |
|
35 |
$field = uuid_schema_field_definition(); |
|
36 |
foreach (uuid_get_core_entity_info() as $entity_type => $info) { |
|
37 |
$schema[$info['base table']]['fields'][$info['entity keys']['uuid']] = $field; |
|
38 |
if (!empty($info['revision table']) && !empty($info['entity keys']['revision uuid'])) { |
|
39 |
$schema[$info['revision table']]['fields'][$info['entity keys']['revision uuid']] = $field; |
|
34 |
function uuid_schema_alter(array &$schema) { |
|
35 |
$field_info = uuid_schema_field_definition(); |
|
36 |
$key_names = array( |
|
37 |
'base table' => 'uuid', |
|
38 |
'revision table' => 'revision uuid', |
|
39 |
); |
|
40 |
|
|
41 |
foreach (uuid_get_core_entity_info() as $entity_info) { |
|
42 |
foreach ($key_names as $table_type => $key_name) { |
|
43 |
if (isset($entity_info[$table_type], $entity_info['entity keys'][$key_name])) { |
|
44 |
$field_name = $entity_info['entity keys'][$key_name]; |
|
45 |
$properties = array( |
|
46 |
'fields' => $field_info, |
|
47 |
'indexes' => array($field_name), |
|
48 |
); |
|
49 |
|
|
50 |
foreach ($properties as $property => $value) { |
|
51 |
$schema[$entity_info[$table_type]][$property][$field_name] = $value; |
|
52 |
} |
|
53 |
} |
|
40 | 54 |
} |
41 | 55 |
} |
42 | 56 |
} |
... | ... | |
51 | 65 |
} |
52 | 66 |
|
53 | 67 |
/** |
54 |
* Install the 'uuid' and 'vuuid' fields into Drupal core entity tables where needed.
|
|
68 |
* Install the uuid and vuuid fields for Drupal core entity tables where needed.
|
|
55 | 69 |
* |
56 |
* IMPORTANT: This function is called both at install and update time. If this method
|
|
57 |
* is modified to add additional fields in the future, the update strategy must be
|
|
58 |
* considered. See the comment in uuid_update_7102. |
|
70 |
* IMPORTANT: This function is called both at install and update time. If this |
|
71 |
* method is modified to add additional fields in the future, the update
|
|
72 |
* strategy must be considered. See the comment in uuid_update_7102.
|
|
59 | 73 |
*/ |
60 | 74 |
function _uuid_install_uuid_fields() { |
61 | 75 |
$field = uuid_schema_field_definition(); |
62 |
foreach (uuid_get_core_entity_info() as $entity_type => $info) {
|
|
76 |
foreach (uuid_get_core_entity_info() as $info) { |
|
63 | 77 |
if (!db_field_exists($info['base table'], $info['entity keys']['uuid'])) { |
64 | 78 |
db_add_field($info['base table'], $info['entity keys']['uuid'], $field); |
65 | 79 |
db_add_index($info['base table'], $info['entity keys']['uuid'], array($info['entity keys']['uuid'])); |
... | ... | |
77 | 91 |
* Implements hook_uninstall(). |
78 | 92 |
*/ |
79 | 93 |
function uuid_uninstall() { |
80 |
foreach (uuid_get_core_entity_info() as $entity_type => $info) {
|
|
94 |
foreach (uuid_get_core_entity_info() as $info) { |
|
81 | 95 |
if (db_field_exists($info['base table'], $info['entity keys']['uuid'])) { |
82 | 96 |
db_drop_field($info['base table'], $info['entity keys']['uuid']); |
83 | 97 |
db_drop_index($info['base table'], $info['entity keys']['uuid']); |
... | ... | |
113 | 127 |
} |
114 | 128 |
|
115 | 129 |
/** |
116 |
* For each of out tables, drop the indexe on the UUID column and add a unique |
|
117 |
* key on that column. |
|
130 |
* Make all uuid columns unique keys instead of indexes. |
|
118 | 131 |
*/ |
119 | 132 |
function uuid_update_6002() { |
120 | 133 |
$ret = array(); |
... | ... | |
139 | 152 |
} |
140 | 153 |
|
141 | 154 |
/** |
142 |
* Fix the column definitions for uuid columns in all tables |
|
143 |
* to use the more efficient char spec. |
|
155 |
* Change column definitions for uuid columns to more efficient char spec. |
|
144 | 156 |
*/ |
145 | 157 |
function uuid_update_6004() { |
146 | 158 |
$ret = array(); |
... | ... | |
159 | 171 |
} |
160 | 172 |
|
161 | 173 |
/** |
174 |
* Support deleting node revision. |
|
175 |
* |
|
162 | 176 |
* Modify existing uuid_node_revisions table to support revision deletion, and |
163 | 177 |
* add in as much legacy data as possible. |
164 | 178 |
*/ |
... | ... | |
205 | 219 |
} |
206 | 220 |
|
207 | 221 |
/** |
208 |
* Clear cache for installations that used alpha1. Modules that previously was |
|
209 |
* enabled in uuid_update_7100() doesn't exist anymore. |
|
222 |
* Clear cache for installations that used alpha1. |
|
223 |
* |
|
224 |
* Modules previously enabled in uuid_update_7100() don't exist any more. We |
|
225 |
* need to clear the cache so Drupal detects this change. |
|
210 | 226 |
*/ |
211 | 227 |
function uuid_update_7101() { |
212 | 228 |
drupal_flush_all_caches(); |
213 | 229 |
} |
214 | 230 |
|
215 | 231 |
/** |
216 |
* Insure that the uuid and vuuid fields are added where needed.
|
|
232 |
* Ensure that the uuid and vuuid fields are added where needed.
|
|
217 | 233 |
* |
218 | 234 |
* Note that update 7102 calls _uuid_install_uuid_fields(), which is an |
219 | 235 |
* idempotent function. If _uuid_install_uuid_fields() is changed at some |
... | ... | |
221 | 237 |
* will have run update 7102, and some will not. A new uuid_update_7103() |
222 | 238 |
* function would would therefore be necessary to update all users to |
223 | 239 |
* the latest schema. At the same time, uuid_update_7102() could become |
224 |
* an empty function, as it would not be necessary to call _uuid_install_uuid_fields()
|
|
225 |
* twice. |
|
240 |
* an empty function, as it would not be necessary to call |
|
241 |
* _uuid_install_uuid_fields() twice.
|
|
226 | 242 |
*/ |
227 | 243 |
function uuid_update_7102() { |
228 | 244 |
// If the user have disabled the UUID module during upgrade (as UPGRADE.txt |
... | ... | |
233 | 249 |
} |
234 | 250 |
|
235 | 251 |
/** |
252 |
* Clean up entities created by uuid_default_entities_example module. |
|
253 |
* |
|
236 | 254 |
* Modify the labels of all example entities created by the now removed |
237 |
* uuid_default_entities_example.module to make it clear they're examples. |
|
238 |
* Also remove the administrator role of any example user.
|
|
255 |
* uuid_default_entities_example.module to make it clear they're examples. Also
|
|
256 |
* remove the administrator role of any example user. |
|
239 | 257 |
*/ |
240 | 258 |
function uuid_update_7103() { |
241 | 259 |
// These are UUIDs of all the example entities that might exist after having |
... | ... | |
250 | 268 |
'7cf875e6-dc15-4404-f190-5a7c3e91d14c', |
251 | 269 |
), |
252 | 270 |
); |
253 |
// we can't assume taxonomy is enabled
|
|
271 |
// We can't assume taxonomy is enabled.
|
|
254 | 272 |
if (isset($info['taxonomy_term'])) { |
255 | 273 |
$uuids['taxonomy_term'] = array( |
256 | 274 |
'bcb92ce8-2236-e264-65c8-0c163ae716d1', |
Formats disponibles : Unified diff
Weekly update of contrib modules