You are here

function ldap_servers_requirements in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 8.4 ldap_servers/ldap_servers.install \ldap_servers_requirements()
  2. 8.3 ldap_servers/ldap_servers.install \ldap_servers_requirements()
  3. 7.2 ldap_servers/ldap_servers.install \ldap_servers_requirements()
  4. 7 ldap_servers/ldap_servers.install \ldap_servers_requirements()

Implements hook_requirements().

File

ldap_servers/ldap_servers.install, line 29
Install, update and uninstall functions for the LDAP API module.

Code

function ldap_servers_requirements($phase) {
  $requirements = array();
  if ($phase == 'install') {
    $requirements['ldap_extension_loaded']['title'] = t('LDAP Extension Loaded');
    if (extension_loaded('ldap')) {
      $requirements['ldap_extension_loaded']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['ldap_extension_loaded']['severity'] = REQUIREMENT_ERROR;
      $requirements['ldap_extension_loaded']['description'] = t('No LDAP PHP Extension is loaded for PHP, so LDAP will not work properly.');
    }
  }
  if ($phase == 'runtime' && !extension_loaded('ldap')) {
    $requirements['ldap_extension_loaded']['title'] = t('LDAP Extension Loaded');
    $requirements['ldap_extension_loaded']['severity'] = REQUIREMENT_ERROR;
    $requirements['ldap_extension_loaded']['description'] = t('No LDAP PHP Extension is loaded for PHP, so LDAP will not work properly.');
  }
  if ($phase != "install" && db_table_exists('ldapauth')) {
    $requirements['ldap_servers']['title'] = t('LDAP Integration LDAP Auth to LDAP Servers Upgrade Concern');
    $requirements['ldap_servers']['severity'] = REQUIREMENT_WARNING;
    $requirements['ldap_servers']['value'] = NULL;
    $requirements['ldap_servers']['description'] = t('Upgrade from Drupal 6 LDAP Auth to Drupal 7
      LDAP Servers is not automatic.  LDAP Servers will need to be configured by hand.
      See http://drupal.org/node/1023016. This message will go away when the ldapauth database table is removed.');
  }

  // check that ldapauth not installed.
  return $requirements;
}