You are here

function cas_attributes_requirements in CAS Attributes 7

Same name and namespace in other branches
  1. 6.3 cas_attributes.install \cas_attributes_requirements()

Implements hook_requirements().

File

./cas_attributes.install, line 19
Installation hooks for the CAS Attributes module.

Code

function cas_attributes_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    if (!function_exists('cas_phpcas_attributes')) {
      $requirements['cas_attributes'] = array(
        'title' => $t('CAS'),
        'value' => $t('Outdated'),
        'severity' => REQUIREMENT_WARNING,
        'description' => $t('CAS attributes requires <a href="@url">CAS</a> version 7.x-1.0 or later.', array(
          '@url' => 'http://drupal.org/project/cas',
        )),
      );
    }

    // Okay to call functions from cas.module since we are in the runtime
    // phase. We hide errors here in case phpcas could not be loaded.
    if ($version = @cas_phpcas_load()) {
      if (!method_exists('phpCAS', 'getAttributes')) {
        $requirements['cas_attributes_phpcas'] = array(
          'title' => $t('phpCAS (Attribute support)'),
          'value' => $version,
          'severity' => REQUIREMENT_WARNING,
          'description' => $t('CAS attributes requires <a href="@url">phpCAS</a> version 1.1.0 or later.', array(
            '@url' => 'https://wiki.jasig.org/display/CASC/phpCAS',
          )),
        );
      }
    }
  }
  return $requirements;
}