You are here

function ldap_servers_requirements in Lightweight Directory Access Protocol (LDAP) 8.3

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. 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 11
Install, update and uninstall functions for the LDAP API module.

Code

function ldap_servers_requirements($phase) {
  $requirements = [];
  if (version_compare(phpversion(), '5.6.0') < 0) {
    $requirements['php_ldap_version'] = [
      'title' => t('PHP Version for LDAP'),
      'description' => t('Your PHP installation is too old for the LDAP module. Please upgrade to at least 5.6, 7.1 is recommended.'),
      'severity' => REQUIREMENT_ERROR,
      'value' => phpversion(),
    ];
  }
  if (extension_loaded('ldap')) {
    $requirements['ldap_extension_loaded'] = [
      'title' => t('PHP LDAP extension'),
      'severity' => REQUIREMENT_OK,
      'value' => t('Available'),
    ];
  }
  else {
    $requirements['ldap_extension_loaded'] = [
      'title' => t('PHP LDAP extension'),
      'severity' => REQUIREMENT_ERROR,
      'value' => t('Missing'),
      'description' => t('The LDAP extension of PHP is not available. Please consult your distribution to discover how to install it.'),
    ];
  }
  return $requirements;
}