add stripe library status to status report

This commit is contained in:
Nathan Coad
2016-07-22 11:37:28 +10:00
parent b132ed9682
commit a97f610661

View File

@@ -930,10 +930,47 @@ function booking_mail($key, &$message, $params) {
}
}
/**
* Implements hook_requirements().
*/
function booking_requirements($phase) {
$requirements = array();
$t = get_t();
//do a runtime verification that the stripe library is installed
if ($phase == 'runtime') {
//check that the stripe library is present
if (($library = libraries_detect('stripe')) && !empty($library['installed'])) {
// The library is installed. Awesome!
$requirements['booking_stripe_library'] = array(
'title' => $t('Booking Module Libraries'),
'description' => $t('Ensure that the stripe module is installed.'),
'value' => libraries_info('stripe'),
'severity' => REQUIREMENT_OK,
);
}
else {
// Something went wrong. :(
// This contains a short status code of what went wrong, such as 'not found'.
//$error = $library['error'];
// This contains a detailed (localized) error message.
$error_message = $library['error message'];
$requirements['booking_stripe_library'] = array(
'title' => $t('Booking Module Libraries'),
'description' => $t('Ensure that the stripe module is installed.'),
'value' => $error_message,
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
/**
* Function for generating the "lucky number" to be used on the lanyard
* @todo move this into a better place. It doesn't belong here
*/
function booking_generate_luckynumbers() {
global $event;
@@ -969,7 +1006,6 @@ function booking_generate_luckynumbers() {
drupal_set_message(t('Finished.'));
return t("<h3>Generate Lucky Numbers</h3>");
}
/*
function booking_form_user_profile_form_alter(&$form, &$form_state) {