-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfwizard.module
101 lines (83 loc) · 2.63 KB
/
confwizard.module
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
<?php
/**
* @file confwizard.module
* Feature Config Wizard
*/
/**
* Implementation of hook_perm
*/
function confwizard_perm() {
return array('administer confwizard', 'follow confwizard');
}
/**
* Implementation of hook_help
*/
function confwizard_help($path, $arg) {
switch($path) {
case "admin/settings/features":
return t("Here you can configure any features which have been installed recently, if they need configuring. Click on the links to go to the relevant configuration pages.");
break;
case "admin/settings":
$status = confwizard_requirements("runtime");
$sev = $status['confwizard']['severity'];
if (isset($sev) && $sev > REQUIREMENT_OK) {
drupal_set_message($status['confwizard']['value'], ($sev > REQUIREMENT_WARNING ? "error" : "warning"));
}
break;
}
}
/**
* Implementation of hook_menu
*/
function confwizard_menu() {
$items['admin/settings/features'] = array(
'title' => 'Features',
'description' => 'Configure any installed features on your site',
'page callback' => 'drupal_get_form',
'page arguments' => array('confwizard_form_follow'),
'access arguments' => array('follow confwizard'),
'file' => 'confwizard.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
$items['admin/build/features/confwizard'] = array(
'title' => 'Config Wizard',
'description' => 'Package up configuration instructions for your features',
'page callback' => 'drupal_get_form',
'page arguments' => array('confwizard_form_admin_settings'),
'access arguments' => array('administer confwizard'),
'file' => 'confwizard.admin.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
return $items;
}
/**
* Menu access callback
*/
function _confwizard_access_admin($perms) {
foreach($perms as $perm) {
$access |= user_access($perm);
}
return $access;
}
/**
* Implementation of hook_requirements
*/
function confwizard_requirements($phase) {
if ($phase != "runtime") { return; }
$requirements['confwizard'] = array(
'title' => t("Features Config Wizard"),
'value' => t('All features are currently fully configured'),
'severity' => REQUIREMENT_OK
);
module_load_include("inc", "confwizard", "confwizard.admin");
$follows = confwizard_db_get_urls();
foreach($follows as $follow) {
if (!$follow['done']) {
$requirements['confwizard']['value'] = t('Some features installed on your site are not currently configured. ')
. l('Please click here to configure these features.', 'admin/settings/features');
$requirements['confwizard']['severity'] = REQUIREMENT_WARNING;
}
}
return $requirements;
}