-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwetkit_widgets.install
72 lines (65 loc) · 2.02 KB
/
wetkit_widgets.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* @file
* wetkit_widgets.install
*/
/**
* Implements hook_uninstall().
*/
function wetkit_widgets_uninstall() {
// Get global variable array.
global $conf;
foreach (array_keys($conf) as $key) {
// Find variables that have the module prefix.
if (strpos($key, 'wetkit_widgets_') === 0) {
variable_del($key);
}
}
}
/**
* Media has been converted to use many sub modules.
*/
function wetkit_widgets_update_7101() {
if (!module_exists('media_wysiwyg')) {
module_enable(array('media_wysiwyg'));
}
if (!module_exists('media_wysiwyg_view_mode')) {
module_enable(array('media_wysiwyg_view_mode'));
}
}
/**
* Media + File Entity hook update correction.
*/
function wetkit_widgets_update_7102() {
// Media (7226) + File Entity (7215) functionality was reverted and hooks
// reused for different functionality which is a bad practice and forces
// us to fix the issue here.
// Accommodate the introduction of a new permission for media browser.
$roles = user_roles(FALSE, 'create files');
foreach ($roles as $rid => $role) {
user_role_grant_permissions($rid, array('access media browser'));
}
// Changing a primary key serial field to an int
// @see https://drupal.org/node/190027
db_add_index('file_metadata', 'temp', array('fid'));
db_drop_primary_key('file_metadata');
db_change_field('file_metadata', 'fid', 'fid', array(
'description' => 'The {file_managed}.fid of the metadata.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
db_add_primary_key('file_metadata', array('fid', 'name'));
db_drop_index('file_metadata', 'temp');
}
/**
* Media + File Entity hook update correction.
*/
function wetkit_widgets_update_7103() {
// Media (7226) + File Entity (7215) functionality was reverted and hooks
// reused for different functionality which is a bad practice and forces
// us to fix the issue here.
drupal_set_installed_schema_version('file_entity', '7215');
drupal_set_installed_schema_version('media', '7226');
}