-
Notifications
You must be signed in to change notification settings - Fork 0
/
ding2.install
350 lines (304 loc) · 8.18 KB
/
ding2.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<?php
/**
* @file
* Setup default theme, shortcuts, roles, language, search and features.
*/
/**
* Implements hook_requirements().
*
* Display build version on the status report page.
*/
function ding2_requirements($phase) {
$t = get_t();
// Get version form the profiles info file.
$info = install_profile_info('ding2');
if ($phase == 'runtime') {
return array(
'ddb_version' => array(
'title' => $t('DDB Version'),
'value' => !empty($info['version']) ? $info['version'] : 'development',
'severity' => REQUIREMENT_INFO,
),
);
}
}
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function ding2_install() {
// Set default variables.
$default_theme = 'ddbasic';
$admin_theme = 'seven';
$t = get_t();
//
// Disable all themes and only active default and admin themes.
//
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->execute();
// Enable themes.
theme_enable(array($default_theme, $admin_theme));
// Enable $default_theme.
variable_set('theme_default', $default_theme);
// Enable $admin_theme.
variable_set('admin_theme', $admin_theme);
// Activate admin theme when editing a node.
variable_set('node_admin_theme', '1');
//
// Add shortcuts to the default set on install.
//
$shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME);
$shortcut_set->links = NULL;
$shortcut_set->links = array(
array(
'link_path' => 'admin/config/regional/translate',
'link_title' => $t('Translation'),
'weight' => -17,
),
array(
'link_path' => 'admin/appearance/settings/ddbasic',
'link_title' => $t('Theme settings'),
'weight' => -18,
),
array(
'link_path' => 'admin/config/user-interface/backgrounds',
'link_title' => $t('Backgrounds'),
'weight' => -19,
),
);
shortcut_set_save($shortcut_set);
// Set default source language for i18n module.
variable_set('i18n_string_source_language', 'en');
// Disable configurable timezones for users.
variable_set('configurable_timezones', 0);
// Select the ding_frontpage as front page.
variable_set('site_frontpage', 'ding_frontpage');
//
// Enable ting search as default.
//
variable_set('search_active_modules', array(
'node' => 'node',
'ting_search' => 'ting_search',
'user' => 0,
'mkdru' => 'mkdru',
));
variable_set('search_default_module', 'ting_search');
//
// Enable the panel pages for ting objects and search.
//
variable_set('ting_ting_object_disabled', FALSE);
variable_set('ting_ting_collection_disabled', FALSE);
variable_set('page_manager_search_disabled_ting_search', FALSE);
//
// Allow visitor account creation, but with administrative approval.
//
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
// Submit theme settings.
variable_set('theme_' . $default_theme . '_settings', ding2_theme_settings());
ding_base_rewrite_color_stylesheet();
// Ignore any rebuild messages.
node_access_needs_rebuild(FALSE);
// Ignore any other install messages.
drupal_get_messages();
// Clear caches.
drupal_flush_all_caches();
}
/**
* Set default theme setting for ddbasic.
*
* @return array
* The default theme settings.
*/
function ding2_theme_settings() {
return array(
'toggle_logo' => 1,
'toggle_name' => 0,
'toggle_slogan' => 0,
'toggle_node_user_picture' => 0,
'toggle_comment_user_picture' => 0,
'toggle_comment_user_verification' => 1,
'toggle_favicon' => 1,
'toggle_main_menu' => 1,
'toggle_secondary_menu' => 1,
'default_logo' => 1,
'default_favicon' => 1,
'latto_classes_menu_leaf' => 1,
'latto_classes_menu_has_children' => 1,
'latto_classes_menu_items_mlid' => 1,
'main_menu_sticky' => 0,
'load_html5js' => 1,
'load_selectivizr' => 1,
'load_scalefixjs' => 1,
'load_equalize' => 1,
'libraries_check_all' => 0,
);
}
/**
* Update the database with the newest translations.
*/
function ding2_translation_update() {
// Update build-in translation group.
$file = new stdClass();
$file->uri = DRUPAL_ROOT . '/profiles/ding2/translations/da.po';
$file->filename = basename($file->uri);
_locale_import_po($file, 'da', LOCALE_IMPORT_KEEP, 'default');
// Update field translation group.
$file = new stdClass();
$file->uri = DRUPAL_ROOT . '/profiles/ding2/translations/fields_da.po';
$file->filename = basename($file->uri);
_locale_import_po($file, 'da', LOCALE_IMPORT_KEEP, 'field');
}
/**
* Enable new shortcuts.
*/
function ding2_update_7000() {
$t = get_t();
$shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME);
$shortcut_set->links[] = array(
'link_path' => 'admin/appearance/settings/ddbasic',
'link_title' => $t('Theme settings'),
'weight' => -18,
);
$shortcut_set->links[] = array(
'link_path' => 'admin/config/user-interface/backgrounds',
'link_title' => $t('Backgrounds'),
'weight' => -19,
);
shortcut_set_save($shortcut_set);
return array();
}
/**
* Append default ddbasic theme settings.
*/
function ding2_update_7001() {
module_load_include('inc', 'system', 'system.admin');
$form_state = form_state_defaults();
$form_state['build_info']['args'][0] = 'ddbasic';
$form_state['values'] = array();
$form_state['values']['scheme'] = 'classic';
drupal_form_submit('system_theme_settings', $form_state);
}
/**
* Import our own translations.
*/
function ding2_update_7002() {
ding2_translation_update();
}
/**
* Enable and configure the cookie module.
*/
function ding2_update_7003() {
module_enable(array('cookiecontrol'));
ding2_set_cookie_page();
}
/**
* Update our own translations.
*/
function ding2_update_7004() {
// Fixed month translation.
ding2_translation_update();
}
/**
* Enable and configure SSL proxy variables.
*/
function ding2_update_7005() {
module_enable(array('sslproxy'), TRUE);
variable_set('sslproxy_var', 'X-FORWARDED-PROTO');
variable_set('sslproxy_var_value', 'https');
}
/**
* Add "administrators" role to admin user.
*/
function ding2_update_7006() {
ding2_add_administrators_role(1);
}
/**
* Update our own translations.
*/
function ding2_update_7007() {
// Fixed month translation.
ding2_translation_update();
}
/**
* Enable view unpublished module.
*/
function ding2_update_7008() {
module_enable(array('view_unpublished'), TRUE);
}
/**
* Enable redirect module.
*/
function ding2_update_7009() {
module_enable(array('redirect'));
}
/**
* Disable the cookiecontrol module.
* Enable and configure the eu-cookie-compliance module.
*/
function ding2_update_7010() {
if (module_exists('cookiecontrol')) {
module_disable(array('cookiecontrol'));
drupal_uninstall_modules(array('cookiecontrol'));
variable_del('cookiecontrol_privacynode');
variable_del('cookiecontrol_text');
variable_del('cookiecontrol_fulltext');
}
module_enable(array('eu_cookie_compliance'));
ding2_set_cookie_page();
if (module_exists('secure_permissions')) {
secure_permissions_build_permissions();
}
}
/**
* Enable maintenance_mode_api module.
*/
function ding2_update_7011() {
module_enable(array('maintenance_mode_api'));
}
/**
* Update the eu-cookie-compliance Danish "No thanks" text to "Læs mere".
*/
function ding2_update_7012() {
$eu_cookie_compliance_da = variable_get('eu_cookie_compliance_da');
$eu_cookie_compliance_da['popup_disagree_button_message'] = 'Læs mere';
variable_set('eu_cookie_compliance_da', $eu_cookie_compliance_da);
}
/**
* Update our own translations.
*/
function ding2_update_7013() {
ding2_translation_update();
}
/**
* Enable pagepreview module.
*/
function ding2_update_7014() {
module_enable(array('pagepreview'));
}
/**
* Enable search_api modules.
*/
function ding2_update_7015() {
module_enable(array('search_api', 'search_api_multi', 'search_api_db', 'search_api_views'));
}
/**
* Update our own translations.
*/
function ding2_update_7016() {
ding2_translation_update();
}
/**
* Update our own translations.
*/
function ding2_update_7017() {
ding2_translation_update();
}
/**
* Update our own translations.
*/
function ding2_update_7018() {
ding2_translation_update();
}