-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate_field_countdown.install
93 lines (79 loc) · 3.56 KB
/
date_field_countdown.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
<?php
/**
* @file
* Install, update and uninstall functions for the date_ical module.
*/
/**
* Implements hook_requirements().
*/
function date_field_countdown_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'runtime') {
if (!function_exists('libraries_detect')) {
$requirements['date_field_countdown'] = array(
'title' => $t('Date Field Countdown'),
'value' => $t('Libraries module is not installed.'),
'description' => $t('jQuery Countdown and above require the Libraries module. Please install it from !here.',
array('!here' => l('here', 'http://www.drupal.org/project/libraries'))
),
'severity' => REQUIREMENT_ERROR,
);
// Return immediately, since we can't even attempt to determine if iCalcreator is installed.
return $requirements;
}
$libCountdown = libraries_detect('countdown');
$libTimeCircles = libraries_detect('TimeCircles');
$ok = false;
$message = array();
if ($libCountdown && !empty($libCountdown['installed'])) {
$ok = true;
$requirements['date_field_countdown_countdown'] = array(
'title' => $t('Date Field Countdown: Countdown Library'),
'value' => $t('Countdown library is installed, version: @version found', array('@version' => $libCountdown['version'])),
'severity' => REQUIREMENT_OK,
);
} else {
$requirements['date_field_countdown_countdown'] = array(
'title' => $t('Date Field Countdown: Countdown Library'),
'value' => $t('Countdown library could not be found, check the installation instructions for the Date Field Countdown module.'),
'description' => $t('The error message was: @error<br>!error_message',
array('@error' => $libCountdown['error'], '!error_message' => $libCountdown['error message'])
),
'severity' => REQUIREMENT_INFO,
);
}
if ($libTimeCircles && !empty($libTimeCircles['installed'])) {
$ok = true;
$requirements['date_field_countdown_timecircles'] = array(
'title' => $t('Date Field Countdown: TimeCircles Library'),
'value' => $t('TimeCircles library is installed, version: @version found', array('@version' => $libTimeCircles['version'])),
'severity' => REQUIREMENT_OK,
);
} else {
$requirements['date_field_countdown_timecircles'] = array(
'title' => $t('Date Field Countdown: TimeCircles Library'),
'value' => $t('TimeCircles library could not be found, check the installation instructions for the Date Field Countdown module.'),
'description' => $t('The error message was: @error<br>!error_message',
array('@error' => $libTimeCircles['error'], '!error_message' => $libTimeCircles['error message'])
),
'severity' => REQUIREMENT_INFO,
);
}
if($ok) {
} else {
$requirements['date_field_countdown'] = array(
'title' => $t('Date Field Countdown'),
'value' => $t('countdown library could not be found, check the installation instructions for the Date Field Countdown module.'),
'description' => $t('The error message was: @error<br>!error_message',
array('@error' => $libCountdown['error'], '!error_message' => $libCountdown['error message'])
),
'severity' => REQUIREMENT_ERROR,
);
$requirements['date_field_countdown_countdown']['severity'] = REQUIREMENT_ERROR;
$requirements['date_field_countdown_timecircles']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}