You are here

function ldap_servers_requirements in Lightweight Directory Access Protocol (LDAP) 7

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

Implements hook_requirements().

File

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

Code

function ldap_servers_requirements($phase) {
  $requirements = array();
  $requirements['ldap_extension_loaded']['title'] = t('LDAP Extension Loaded');
  if (extension_loaded('ldap') && function_exists('ldap_search')) {
    $requirements['ldap_extension_loaded']['value'] = t('Passed');
    $requirements['ldap_extension_loaded']['severity'] = REQUIREMENT_OK;
  }
  else {
    $requirements['ldap_extension_loaded']['value'] = t('Failed');
    $requirements['ldap_extension_loaded']['severity'] = REQUIREMENT_ERROR;
    $requirements['ldap_extension_loaded']['description'] = t('No LDAP Extension is loaded for PHP, so LDAP will not work properly.');
  }
  if ($phase != "install" && db_table_exists('ldapauth')) {
    $requirements['ldap_servers_ldap_integration']['title'] = t('LDAP Integration LDAP Auth to LDAP Servers Upgrade Concern');
    $requirements['ldap_servers_ldap_integration']['severity'] = REQUIREMENT_WARNING;
    $requirements['ldap_servers_ldap_integration']['value'] = NULL;
    $requirements['ldap_servers_ldap_integration']['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;
}