cas_roles.install in CAS roles 6
Same filename and directory in other branches
Installation hooks for the CAS Attributes module.
File
cas_roles.installView source
<?php
/**
* @file
* Installation hooks for the CAS Attributes module.
*/
/**
* Implements hook_uninstall().
*/
function cas_roles_uninstall() {
// Delete variables.
variable_del('cas_roles_sync_every_login');
variable_del('cas_roles_behavior');
variable_del('cas_roles_roles');
variable_del('cas_roles_relations');
}
/**
* Implements hook_requirements().
*/
function cas_roles_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
if (!function_exists('cas_phpcas_attributes')) {
$requirements['cas_roles'] = array(
'title' => $t('CAS'),
'value' => $t('Outdated'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('CAS roles 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_roles_phpcas'] = array(
'title' => $t('phpCAS (Attribute support)'),
'value' => $version,
'severity' => REQUIREMENT_WARNING,
'description' => $t('CAS roles requires <a href="@url">phpCAS</a> version 1.1.0 or later.', array(
'@url' => 'https://wiki.jasig.org/display/CASC/phpCAS',
)),
);
}
}
}
return $requirements;
}
Functions
Name | Description |
---|---|
cas_roles_requirements | Implements hook_requirements(). |
cas_roles_uninstall | Implements hook_uninstall(). |