-
Notifications
You must be signed in to change notification settings - Fork 0
/
memberdb.install
31 lines (27 loc) · 1.12 KB
/
memberdb.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
<?php
/**
* @file
*/
function memberdb_requirements($phase = 'runtime') {
global $db_url;
$requirements = array();
$t = get_t();
$requirements['memberdb'] = array(
'title' => $t('MemberDB')
);
if (is_array($db_url) || !empty($db_url['memberdb'])) {
db_set_active('memberdb');
$count = db_result(db_query("SELECT COUNT(*) FROM members"));
db_set_active();
$uri = parse_url($db_url['memberdb']);
$requirements['memberdb']['severity'] = REQUIREMENT_OK;
$requirements['memberdb']['value'] = $t('MemberDB is configured.');
$requirements['memberdb']['description'] = $t('MemberDB is using the %uri database, which contains information about @members.', array('%uri' => $uri['scheme'] .'://'. $uri['host'] . $uri['path'], '@members' => format_plural($count, '1 member', '@count members')));
}
else {
$requirements['memberdb']['severity'] = REQUIREMENT_ERROR;
$requirements['memberdb']['value'] = $t('MemberDB is not configured.');
$requirements['memberdb']['description'] = $t('You have not created a MemberDB $db_url. Please check the README file.');
}
return $requirements;
}