Commit 7f7bafe9 authored by Robert Rollins's avatar Robert Rollins

Issue #2127549: Fixed a protential error state in the upgrade path from v1.x.

User oskar_calvo discovered that if you update Date iCal from 1.x, but
don't also install the Libraries module, you'll get a fatal error when Date iCal
attempts to check for the iCalcreator library, because the libraries_detect()
function doesn't exist.

Now, you'll instead see an error in the site requirements.
parent cd17423a
...@@ -13,27 +13,38 @@ function date_ical_requirements($phase) { ...@@ -13,27 +13,38 @@ function date_ical_requirements($phase) {
// Ensure translations don't break at install time. // Ensure translations don't break at install time.
$t = get_t(); $t = get_t();
switch ($phase) { if ($phase == 'runtime') {
case 'runtime': if (!function_exists('libraries_detect')) {
$library = libraries_detect('iCalcreator'); $requirements['date_ical'] = array(
if ($library && !empty($library['installed'])) { 'title' => $t('Date iCal'),
$requirements['date_ical'] = array( 'value' => $t('Libraries module is not installed.'),
'title' => $t('Date iCal'), 'description' => $t('Date iCal 2.x and above require the Libraries module. Please install it from !here.',
'value' => $t('iCalcreator library is installed, version: @version found', array('@version' => $library['version'])), array('!here' => l('here', 'http://www.drupal.org/project/libraries'))
'severity' => REQUIREMENT_OK, ),
); 'severity' => REQUIREMENT_ERROR,
} );
else { // Return immediately, since we can't even attempt to determine if iCalcreator is installed.
$requirements['date_ical'] = array( return $requirements;
'title' => $t('Date iCal'), }
'value' => $t('iCalcreator library could not be found, check the installation instructions for the Date iCal module.'),
'description' => $t('The error message was: @error<br>!error_message', $library = libraries_detect('iCalcreator');
array('@error' => $library['error'], '!error_message' => $library['error message']) if ($library && !empty($library['installed'])) {
), $requirements['date_ical'] = array(
'severity' => REQUIREMENT_ERROR, 'title' => $t('Date iCal'),
); 'value' => $t('iCalcreator library is installed, version: @version found', array('@version' => $library['version'])),
} 'severity' => REQUIREMENT_OK,
break; );
}
else {
$requirements['date_ical'] = array(
'title' => $t('Date iCal'),
'value' => $t('iCalcreator library could not be found, check the installation instructions for the Date iCal module.'),
'description' => $t('The error message was: @error<br>!error_message',
array('@error' => $library['error'], '!error_message' => $library['error message'])
),
'severity' => REQUIREMENT_ERROR,
);
}
} }
return $requirements; return $requirements;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment