You are here

function date_api_requirements in Date 6

Same name and namespace in other branches
  1. 5.2 date_api.install \date_api_requirements()
  2. 6.2 date_api.install \date_api_requirements()
  3. 7.3 date_api/date_api.install \date_api_requirements()
  4. 7.2 date_api/date_api.install \date_api_requirements()

Implementation of hook_requirements(). Make sure Date PHP4 is installed if running less than PHP 5.2.

File

./date_api.install, line 66

Code

function date_api_requirements($phase) {
  $requirements = array();
  $t = get_t();

  //switch ($phase) {

  //   case 'runtime':
  $tz_name = variable_get('date_default_timezone_name', NULL);
  $error = FALSE;
  if (version_compare(PHP_VERSION, '5.2', '<') && !module_exists('date_php4')) {
    $error = TRUE;
    $severity = REQUIREMENT_ERROR;
    $value = $t('The Date API module requires the !link for PHP versions less than 5.2.', array(
      '!link' => l($t('Date PHP4 module'), 'admin/build/modules'),
    ));
  }
  if ($error) {
    $requirements['date_php4'] = array(
      'title' => $t('Date API requirements'),
      'value' => $value,
      'severity' => $severity,
    );
  }

  //    break;
  //   case 'install':
  //    break;

  //}
  return $requirements;
}