-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensourcery_install.install
77 lines (70 loc) · 2.38 KB
/
opensourcery_install.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
<?php
/**
* @file
* Main profile installation logic.
*/
/**
* Implementation of hook_install().
*/
function opensourcery_install_install() {
// Don't display date and author information for page nodes by default.
$theme_settings = variable_get('theme_settings', array());
$theme_settings['toggle_node_info_page'] = FALSE;
variable_set('theme_settings', $theme_settings);
// Initial permissions.
// @TODO _opensourcery_install_set_permissions();
// Clean up after pathauto.
variable_del('pathauto_node_page_pattern');
variable_del('pathauto_node_story_pattern');
// User settings
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
variable_set('anonymous', 'Visitor');
// Increase the capacity of the Drupal watchdog. The default of 1000 rows
// overflows too quickly, sometimes losing important debug information.
variable_set('dblog_row_limit', 10000);
}
/**
* Set some sensible permissions.
*/
function _opensourcery_install_set_permissions() {
$roles = user_roles();
$admin_rid = array_search('administrator', $roles);
$admin_user_perms = array(
'access administration menu',
'create url aliases',
'administer menu',
'administer nodes',
'revert revisions',
'view revisions',
'assign site editor role',
'assign administrator role',
'administer users',
'access administration pages',
);
if (!db_query("SELECT rid FROM {permission} LEFT JOIN {role} USING (rid) WHERE name = :role_name", array(':role_name' => 'administrator'))->fetchField()) {
$fields = array(
'rid' => $admin_rid,
'perm' => implode(', ', $admin_user_perms),
);
db_insert('permission')
->fields($fields)
->execute();
drupal_set_message(t("Set sensible defaults for %role role.", array('%role' => 'administrator')));
}
$site_editor_rid = array_search('site editor', $roles);
$site_editor_user_perms = array(
'create url aliases',
'revert revisions',
'view revisions',
);
if (!db_query("SELECT rid FROM {permission} LEFT JOIN {role} USING (rid) WHERE name = '%s'", array(':role_name' => 'site editor'))->fetchField()) {
$fields = array(
'rid' => $site_editor_rid,
'perm' => $site_editor_user_perms,
);
db_insert('permission')
->fields($fields)
->execute();
drupal_set_message(t("Set sensible defaults for %role role.", array('%role' => 'site editor')));
}
}