diff --git a/date_ical.install b/date_ical.install index dc55b4725da6978018ace7eec2d2b56e07b2fdde..c3f43f2e5217eab646f0a84aac7e356cb56fa506 100644 --- a/date_ical.install +++ b/date_ical.install @@ -13,27 +13,38 @@ function date_ical_requirements($phase) { // Ensure translations don't break at install time. $t = get_t(); - switch ($phase) { - case 'runtime': - $library = libraries_detect('iCalcreator'); - if ($library && !empty($library['installed'])) { - $requirements['date_ical'] = array( - 'title' => $t('Date iCal'), - 'value' => $t('iCalcreator library is installed, version: @version found', array('@version' => $library['version'])), - 'severity' => REQUIREMENT_OK, - ); - } - 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
!error_message', - array('@error' => $library['error'], '!error_message' => $library['error message']) - ), - 'severity' => REQUIREMENT_ERROR, - ); - } - break; + if ($phase == 'runtime') { + if (!function_exists('libraries_detect')) { + $requirements['date_ical'] = array( + 'title' => $t('Date iCal'), + 'value' => $t('Libraries module is not installed.'), + 'description' => $t('Date iCal 2.x 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; + } + + $library = libraries_detect('iCalcreator'); + if ($library && !empty($library['installed'])) { + $requirements['date_ical'] = array( + 'title' => $t('Date iCal'), + 'value' => $t('iCalcreator library is installed, version: @version found', array('@version' => $library['version'])), + 'severity' => REQUIREMENT_OK, + ); + } + 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
!error_message', + array('@error' => $library['error'], '!error_message' => $library['error message']) + ), + 'severity' => REQUIREMENT_ERROR, + ); + } } return $requirements;