-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclair.install
More file actions
executable file
·229 lines (219 loc) · 7.2 KB
/
clair.install
File metadata and controls
executable file
·229 lines (219 loc) · 7.2 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
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
<?php
!function_exists('profiler_v2') ? require_once('libraries/profiler/profiler.inc') : FALSE;
profiler_v2('clair');
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*/
function clair_install() {
// Enable some clair blocks.
$default_theme = 'clair_theme';
$admin_theme = 'ember';
// disable all themes
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->execute();
// enable $default_theme
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $default_theme)
->execute();
// enable $admin_theme
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $admin_theme)
->execute();
variable_set('admin_theme', $admin_theme);
// activate admin theme when editing a node
variable_set('node_admin_theme', '1');
$blocks = 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' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => -10,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
// drop system / user blocks to ensure correct building
db_delete('block')->condition('module', 'system')->execute();
db_delete('block')->condition('module', 'user')->execute();
// add in our blocks defined above
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($blocks as $block) {
$query->values($block);
}
$query->execute();
// revert features to ensure they are all installed
$features = array(
'clair_admin'
);
//features_revert($features);
// From shortcut.install, 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/appearance/settings',
'link_title' => st('Theme'),
'weight' => -17,
),
);
//add the menu links for adding content to management menu
$result = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = :menu_name AND link_title = :link_title AND link_path = :link_path", array(':menu_name'=>'management',':link_title'=>'Content',':link_path'=>'admin/content'))->fetchObject();
$plid = $result->mlid ? $result->mlid : 0;
if ($plid) {
$menu_links_management = array(
'management_add-content:node/add' => array(
'customized' => 1,
'has_children' => 1,
'link_path' => 'node/add',
'link_title' => 'Add Content',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_add-content:node/add',
),
'plid' => $plid,
'router_path' => 'node/add',
),
);
foreach($menu_links_management as $key=>$menu_link_item) {
menu_link_save($menu_link_item);
}
$result = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = :menu_name AND link_title = :link_title AND link_path = :link_path", array(':menu_name'=>'management',':link_title'=>'Add Content',':link_path'=>'node/add'))->fetchObject();
$plid = $result->mlid ? $result->mlid : 0;
if ($plid) {
$menu_links_management = array(
'management_article:node/add/article' => array(
'customized' => 1,
'link_path' => 'node/add/article',
'link_title' => 'Article',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_article:node/add/article',
),
'plid' => $plid,
'router_path' => 'node/add/article',
),
'management_collection:node/add/collection' => array(
'customized' => 1,
'link_path' => 'node/add/collection',
'link_title' => 'Collection',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_collection:node/add/collection',
),
'plid' => $plid,
'router_path' => 'node/add/collection',
),
'management_event:node/add/event' => array(
'customized' => 1,
'link_path' => 'node/add/event',
'link_title' => 'Event',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_event:node/add/event',
),
'plid' => $plid,
'router_path' => 'node/add/event',
),
'management_object:node/add/object' => array(
'customized' => 1,
'link_path' => 'node/add/object',
'link_title' => 'Object',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_object:node/add/object',
),
'plid' => $plid,
'router_path' => 'node/add/object',
),
'management_page:node/add/page' => array(
'customized' => 1,
'link_path' => 'node/add/page',
'link_title' => 'Page',
'menu_name' => 'management',
'module' => 'menu',
'options' => array(
'identifier' => 'management_page:node/add/page',
),
'plid' => $plid,
'router_path' => 'node/add/page',
),
);
foreach($menu_links_management as $key=>$menu_link_item) {
menu_link_save($menu_link_item);
}
}
}
shortcut_set_save($shortcut_set);// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 10;
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();
// Update the menu router information.
menu_rebuild();
// ignore any rebuild messages
node_access_needs_rebuild(FALSE);
// ignore any other install messages
drupal_get_messages();
}