forked from vopros-dk/vopros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvopros.install
119 lines (110 loc) · 3.43 KB
/
vopros.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
<?php
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function vopros_install() {
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'bartik');
$values = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'user',
'delta' => 'login',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'navigation',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'management',
'theme' => $default_theme,
'status' => 1,
'weight' => 1,
'region' => 'sidebar_first',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
foreach ($values as $record) {
$keys = array_intersect_key($record, array_flip(array('module', 'delta', 'theme')));
$fields = array_intersect_key($record, array_flip(array('status', 'weight', 'region', 'pages', 'cache')));
$query = db_merge('block')
->fields($fields)
->key($keys);
$query->execute();
}
// Allow visitor account creation, but with administrative approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
// Enable default permissions for system roles.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
// Enable the admin theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'seven')
->execute();
variable_set('admin_theme', 'seven');
variable_set('node_admin_theme', '1');
// Create a default role for site administrators, with all available
// permissions assigned. Lifted from standard profile
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 50;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array('uid' => 1, 'rid' => $admin_role->rid))
->execute();
// Create a role for question answering staff.
$staff_role = new stdClass();
$staff_role->name = 'staff';
$staff_role->weight = 2;
user_role_save($staff_role);
variable_set('vopros_user_staff_role', $staff_role->rid);
// Set date formats.
variable_set('date_format_long', 'l, F j, Y - H:i');
variable_set('date_format_medium', 'D, Y-m-d H:i');
variable_set('date_format_short', 'd/m/Y - H:i');
// Set up automatic translation update.
variable_set('l10n_update_check_frequency', '7');
variable_set('l10n_update_check_mode', '3');
variable_set('l10n_update_import_mode', '2');
}