Révision 1e39edcb
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install | ||
---|---|---|
5 | 5 |
* Install, update and uninstall functions for the Media WYSIWYG module. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
/** |
|
9 |
* Implements hook_schema(). |
|
10 |
*/ |
|
11 |
function media_wysiwyg_schema() { |
|
12 |
$schema['media_restrict_wysiwyg'] = array( |
|
13 |
'description' => 'Stores media displays restricted in wysiwyg.', |
|
14 |
'fields' => array( |
|
15 |
'type' => array( |
|
16 |
'description' => 'The machine name of the file type.', |
|
17 |
'type' => 'varchar', |
|
18 |
'length' => 255, |
|
19 |
'not null' => TRUE, |
|
20 |
'default' => '', |
|
21 |
), |
|
22 |
'display' => array( |
|
23 |
'description' => 'The restricted display.', |
|
24 |
'type' => 'varchar', |
|
25 |
'length' => '255', |
|
26 |
'not null' => TRUE, |
|
27 |
'default' => '', |
|
28 |
), |
|
29 |
), |
|
30 |
); |
|
31 |
$schema['media_view_mode_wysiwyg'] = array( |
|
32 |
'description' => 'Maps WYSIWYG view modes to file types.', |
|
33 |
'fields' => array( |
|
34 |
'type' => array( |
|
35 |
'description' => 'The machine name of the file type.', |
|
36 |
'type' => 'varchar', |
|
37 |
'length' => 255, |
|
38 |
'not null' => TRUE, |
|
39 |
'default' => '', |
|
40 |
), |
|
41 |
'view_mode' => array( |
|
42 |
'description' => 'WYSIWYG view mode mapped to this file type.', |
|
43 |
'type' => 'varchar', |
|
44 |
'length' => 255, |
|
45 |
'not null' => TRUE, |
|
46 |
'default' => '', |
|
47 |
), |
|
48 |
|
|
49 |
), |
|
50 |
); |
|
51 |
return $schema; |
|
52 |
} |
|
53 |
|
|
8 | 54 |
/** |
9 | 55 |
* Implements hook_install(). |
10 | 56 |
*/ |
... | ... | |
106 | 152 |
)); |
107 | 153 |
} |
108 | 154 |
} |
155 |
|
|
156 |
/** |
|
157 |
* Install {media_restrict_wysiwyg} and {media_view_mode_wysiwyg}. |
|
158 |
* |
|
159 |
* Remove variables media_wysiwyg_view_mode_%. |
|
160 |
* |
|
161 |
* Uninstall media_wysiwyg_view_mode module. |
|
162 |
*/ |
|
163 |
function media_wysiwyg_update_7205() { |
|
164 |
$schema = media_wysiwyg_schema(); |
|
165 |
|
|
166 |
if (!db_table_exists('media_restrict_wysiwyg')) { |
|
167 |
db_create_table('media_restrict_wysiwyg', $schema['media_restrict_wysiwyg']); |
|
168 |
db_create_table('media_view_mode_wysiwyg', $schema['media_view_mode_wysiwyg']); |
|
169 |
} |
|
170 |
|
|
171 |
db_delete('variable')->condition('name', "media_wysiwyg_view_mode_%", "LIKE")->execute(); |
|
172 |
|
|
173 |
// Disable and uninstall View Mode module.Since the view mode module is |
|
174 |
// deleted, this copies from module_disable() and drupal_uninstall_modules(). |
|
175 |
// Disable first. |
|
176 |
$module = 'media_wysiwyg_view_mode'; |
|
177 |
db_update('system') |
|
178 |
->fields(array('status' => 0)) |
|
179 |
->condition('type', 'module') |
|
180 |
->condition('name', $module) |
|
181 |
->execute(); |
|
182 |
system_list_reset(); |
|
183 |
module_list(TRUE); |
|
184 |
module_implements('', FALSE, TRUE); |
|
185 |
entity_info_cache_clear(); |
|
186 |
// Invoke hook_modules_disabled before disabling modules, |
|
187 |
// so we can still call module hooks to get information. |
|
188 |
module_invoke_all('modules_disabled', array($module)); |
|
189 |
// Update the registry to remove the newly-disabled module. |
|
190 |
registry_update(); |
|
191 |
_system_update_bootstrap_status(); |
|
192 |
// Update the theme registry to remove the newly-disabled module. |
|
193 |
drupal_theme_rebuild(); |
|
194 |
|
|
195 |
// Now uninstall. |
|
196 |
drupal_uninstall_schema($module); |
|
197 |
drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED); |
|
198 |
|
|
199 |
module_invoke_all('modules_uninstalled', array($module)); |
|
200 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules