You are here

function ldap_help_get_server in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_help/ldap_help.status.inc \ldap_help_get_server()
  2. 7 ldap_help/ldap_help.status.inc \ldap_help_get_server()
1 call to ldap_help_get_server()
ldap_help_status in ldap_help/ldap_help.status.inc

File

ldap_help/ldap_help.status.inc, line 61
Status file for ldaphelp module.

Code

function ldap_help_get_server($phpinfo, &$info) {
  $info['phpversion'] = phpversion();
  $info['ldaploaded'] = extension_loaded('ldap');
  $info['ldap'] = $phpinfo['ldap'];
  $text = "";
  foreach ($phpinfo['ldap'] as $key => $value) {
    if (is_scalar($value)) {
      $text .= "<br/>{$key}: " . $value;
    }
    else {
      $text .= "<br/>{$key}: " . print_r($value, TRUE);
    }
  }
  $info['ldap']['text'] = $text;
  $modules = system_rebuild_module_data();
  $ldapmodules = [
    'ldap_servers',
    'ldap_authentication',
    'ldap_authorization',
    'ldap_authorization_drupal_role',
    'ldap_authorization_og',
    'ldap_feeds',
    'ldap_query',
    'ldap_sso',
    'ldap_views',
  ];
  foreach ($ldapmodules as $ldapmodule) {
    $data['status'] = $modules[$ldapmodule]->status;
    $data['schema_version'] = $modules[$ldapmodule]->schema_version;
    $data['version'] = $modules[$ldapmodule]->info['version'] ? $modules[$ldapmodule]->info['version'] : 'unknown';
    $data['text'] = "status: " . $data['status'] . ", schema_version: " . $data['schema_version'] . ", v: " . $data['version'];
    $info[$ldapmodule] = $data;
  }

  // Set status array to be converted into html table.
  if (isset($phpinfo['Apache Environment'])) {
    $status[] = [
      'title' => 'Apache',
      'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'],
    ];
  }
  elseif (isset($_SERVER["SERVER_SOFTWARE"])) {
    $status[] = [
      'title' => 'SERVER_SOFTWARE',
      'value' => $_SERVER["SERVER_SOFTWARE"],
    ];
  }
  $status[] = [
    'title' => 'PHP version',
    'value' => phpversion(),
  ];
  if (!$info['ldaploaded']) {
    $status[] = [
      'title' => 'PHP ldap extension not loaded',
      'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work.
    It comes compiled with most versions of PHP.',
      'severity' => REQUIREMENT_ERROR,
    ];
  }
  else {
    $status[] = [
      'title' => 'PHP ldap extension data',
      'value' => $info['ldap']['text'],
      'severity' => 0,
    ];
  }
  $status[] = [
    'title' => 'open ssl extension loaded',
    'value' => extension_loaded('openssl') ? "yes" : "no",
  ];
  $status[] = [
    'title' => 'Drupal',
    'value' => VERSION,
    'severity' => "0",
  ];
  foreach ($ldapmodules as $ldapmodule) {
    $status[] = [
      'title' => $ldapmodule,
      'value' => $info[$ldapmodule]['text'],
      'severity' => "0",
    ];
  }
  return $status;
}