You are here

simple_ldap_sso.install in Simple LDAP 7.2

Same filename and directory in other branches
  1. 7 simple_ldap_sso/simple_ldap_sso.install

Simple LDAP SSO install/update hooks.

File

simple_ldap_sso/simple_ldap_sso.install
View source
<?php

/**
 * @file
 * Simple LDAP SSO install/update hooks.
 */

/**
 * Implements hook_uninstall().
 */
function simple_ldap_sso_uninstall() {
  variable_del('simple_ldap_sso_binddn');
  variable_del('simple_ldap_sso_bindpw');
  variable_del('simple_ldap_sso_encryption_key');
  variable_del('simple_ldap_sso_attribute_sid');
  variable_del('simple_ldap_sso_hashing_algorithm');
  variable_del('simple_ldap_sso_flood_limit');
  variable_del('simple_ldap_sso_flood_window');
}

/**
 * Implements hook_disable().
 */
function simple_ldap_sso_disable() {
  variable_del('session_inc');
}

/**
 * Implements hook_enable().
 */
function simple_ldap_sso_enable() {
  $path = drupal_get_path('module', 'simple_ldap_sso') . '/simple_ldap_sso.session.inc';
  variable_set('session_inc', $path);
}

/**
 * Implements hook_requirements().
 */
function simple_ldap_sso_requirements($phase) {

  // Only check at runtime.
  if ($phase != 'runtime') {
    return;
  }

  // Get the t() function.
  $t = get_t();
  $errors = simple_ldap_configuration_errors();
  $items['simple_ldap_sso_configured'] = array(
    'title' => $t('Simple LDAP SSO'),
    'value' => $errors ? $t('Not Configured') : $t('Configured'),
    'description' => '',
    'severity' => $errors ? REQUIREMENT_ERROR : REQUIREMENT_OK,
  );
  if ($errors) {
    $t_args = array(
      '@url' => url('admin/config/people/simple_ldap/sso'),
    );
    $items['simple_ldap_sso_configured']['description'] = theme('item_list', array(
      'items' => $errors,
    ));
    $items['simple_ldap_sso_configured']['description'] .= $t('Please visit the module’s <a href="@url">configuration form</a> to configure Simple LDAP SSO.', $t_args);
  }
  return $items;
}