-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathopencivic.install
executable file
·198 lines (186 loc) · 5 KB
/
opencivic.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
<?php
/**
* @file
* Install, update and uninstall functions for the OpenCivic installation profile.
*/
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function opencivic_install() {
// Enable the Cat Lover theme
theme_enable(array('cat_man_do'));
variable_set('theme_default', 'cat_man_do');
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'cat_man_do');
$admin_theme = 'seven';
$blocks = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'search',
'delta' => 'form',
'theme' => $default_theme,
'status' => 1,
'weight' => -1,
'region' => 'sidebar_first',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'node',
'delta' => 'recent',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
'region' => 'dashboard_main',
'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' => 'powered-by',
'theme' => $default_theme,
'status' => 1,
'weight' => 10,
'region' => 'footer',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'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,
),
array(
'module' => 'user',
'delta' => 'login',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'user',
'delta' => 'new',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'dashboard_sidebar',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'search',
'delta' => 'form',
'theme' => $admin_theme,
'status' => 1,
'weight' => -10,
'region' => 'dashboard_sidebar',
'pages' => '',
'cache' => -1,
),
);
// $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
// foreach ($blocks as $block) {
// $query->values($block);
// }
// $query->execute();
// Insert core blocks using merge query to avoid unique index constraints.
foreach ($blocks as $value) {
db_merge('block')
->key(
array('theme', 'module', 'delta'),
array($value['theme'], $value['module'], $value['delta'])
)
->fields($value)
->execute();
}
// Default "Basic page" to not be promoted and have comments disabled.
variable_set('node_options_page', array('status'));
variable_set('comment_page', COMMENT_NODE_HIDDEN);
// Don't display date and author information for "Basic page" nodes by default.
variable_set('node_submitted_page', FALSE);
// Enable user picture support and set the default to a square thumbnail option.
variable_set('user_pictures', '1');
variable_set('user_picture_dimensions', '1024x1024');
variable_set('user_picture_file_size', '800');
variable_set('user_picture_style', 'thumbnail');
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
// Enable the admin theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'cat_lover_admin')
->execute();
variable_set('admin_theme', $admin_theme);
variable_set('node_admin_theme', '1');
variable_set('site_frontpage', 'frontpage');
}
/**
* Implements hook_install_tasks_alter()
*/
function opencivic_install_tasks_alter(&$tasks, $install_state) {
// Magically go one level deeper in solving years of dependency problems
require_once(drupal_get_path('module', 'panopoly_core') . '/panopoly_core.profile.inc');
$tasks['install_load_profile']['function'] = 'panopoly_core_install_load_profile';
}