You are here

cas_attributes.install in CAS Attributes 6.3

Same filename and directory in other branches
  1. 7 cas_attributes.install

Installation hooks for the CAS Attributes module.

File

cas_attributes.install
View source
<?php

/**
 * @file
 * Installation hooks for the CAS Attributes module.
 */

/**
 * Implements hook_uninstall().
 */
function cas_attributes_uninstall() {

  // Delete variables.
  variable_del('cas_attributes');
}

/**
 * Implements hook_requirements().
 */
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 6.x-3.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;
}