-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgdpr_cookies.install
More file actions
174 lines (160 loc) · 4.68 KB
/
gdpr_cookies.install
File metadata and controls
174 lines (160 loc) · 4.68 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
/**
* @file
* gdpr_cookies.install
*/
/**
* Implements hook_schema().
*/
function gdpr_cookies_schema() {
$schema['gdpr_cookies_service'] = array(
'description' => 'Stores information about all defined third-party service types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique ID.',
),
'name' => array(
'description' => 'The name of the third-party service.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'info' => array(
'description' => 'The info content of the third-party service.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'label' => array(
'description' => 'The human-readable name of the third-party service.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'enabled' => array(
'description' => 'The flag indicating if service control is activated.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'vanisher' => array(
'description' => 'The name of the relevant vanisher.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x01,
'size' => 'tiny',
'description' => 'The exportable status of the vanisher.',
),
'module' => array(
'description' => 'The name of the providing module if the vanisher has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array('id'),
'unique keys' => array(
'name' => array('name'),
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function gdpr_cookies_uninstall() {
backdrop_uninstall_schema('gdpr_cookies');
}
/**
* Rename table and modify some descriptions.
*/
function gdpr_cookies_update_1001() {
$spec = array();
db_rename_table('third_party_service', 'gdpr_cookies_service');
$spec = array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique ID.',
);
db_change_field('gdpr_cookies_service', 'id', 'id', $spec);
$spec = array(
'description' => 'The name of the third-party service.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
);
db_change_field('gdpr_cookies_service', 'name', 'name', $spec);
$spec = array(
'description' => 'The info content of the third-party service.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
);
db_change_field('gdpr_cookies_service', 'info', 'info', $spec);
$spec = array(
'description' => 'The human-readable name of the third-party service.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
);
db_change_field('gdpr_cookies_service', 'label', 'label', $spec);
$spec = array(
'description' => 'The name of the relevant vanisher.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
);
db_change_field('gdpr_cookies_service', 'vanisher', 'vanisher', $spec);
$spec = array(
'type' => 'int',
'not null' => TRUE,
// Set the default to ENTITY_CUSTOM without using the constant as it is
// not safe to use it at this point.
'default' => 0x01,
'size' => 'tiny',
'description' => 'The exportable status of the vanisher.',
);
db_change_field('gdpr_cookies_service', 'status', 'status', $spec);
$spec = array(
'description' => 'The name of the providing module if the vanisher has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
);
db_change_field('gdpr_cookies_service', 'module', 'module', $spec);
}
/**
* Force a rebuild of the GDPR Cookies menu items following fix to menu item
* definition.
*/
function gdpr_cookies_update_1002() {
db_delete('menu_links')
->condition('link_path', '%' . db_like('gdpr-cookies') . '%', 'LIKE')
->condition('module', 'system')
->execute();
menu_cache_clear('management');
cache('admin_bar')->flush();
}
/**
* Remove AdBlocker configuration as this option is no longer supported.
*/
function gdpr_cookies_update_1003() {
config_clear('gdpr_cookies.settings', 'gdpr_cookies_adblocker');
}