You are here

function ldaphelp_get_server in LDAP integration 6

Get overall server and ldap modules info / versions.

Parameters

Array $phpinfo Parsed PhP modules info.:

Array $info Array being filled by this function.:

Return value

Array Status report information.

1 call to ldaphelp_get_server()
ldaphelp_status in ldaphelp/ldaphelp_status.inc

File

ldaphelp/ldaphelp_status.inc, line 68
status file for ldaphelp module

Code

function ldaphelp_get_server($phpinfo, &$info) {
  $info['phpversion'] = phpversion();
  $info['ldaploaded'] = extension_loaded('ldap');
  $info['ldap'] = $phpinfo['ldap'];
  $text = "";
  foreach ($phpinfo['ldap'] as $key => $value) {
    $text .= "<br/>{$key}: " . $value[0];
  }
  $info['ldap']['text'] = $text;

  //$info['ldap']['text'] = ldaphelp_arraytohtml($phpinfo['ldap']);
  $modules = module_rebuild_cache();
  $ldapmodules = array(
    'ldapauth',
    'ldapgroups',
    'ldapdata',
    'ldaphelp',
    'ldapsync',
  );
  foreach ($ldapmodules as $ldapmodule) {
    $data['status'] = $modules[$ldapmodule]->status;
    $data['schema_version'] = $modules[$ldapmodule]->schema_version;
    $data['version'] = $modules[$ldapmodule]->info['version'];
    $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 ($phpinfo['Apache Environment']) {
    $status[] = array(
      'title' => 'Apache',
      'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'],
    );
  }
  elseif ($_SERVER["SERVER_SOFTWARE"]) {
    $status[] = array(
      'title' => 'SERVER_SOFTWARE',
      'value' => $_SERVER["SERVER_SOFTWARE"],
    );
  }
  $status[] = array(
    'title' => 'PHP version',
    'value' => phpversion(),
  );
  if (!$info['ldaploaded']) {
    $status[] = array(
      'title' => 'PHP ldap extension not loaded',
      'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' ' . t('must be loaded for LDAP Integration to work.
    It comes compiled with most versions of PHP.'),
      'severity' => REQUIREMENT_ERROR,
    );
  }
  else {
    $status[] = array(
      'title' => 'PHP ldap extension data',
      'value' => $info['ldap']['text'],
      'severity' => 0,
    );
  }
  $status[] = array(
    'title' => 'Drupal',
    'value' => VERSION,
    'severity' => "0",
  );
  foreach ($ldapmodules as $ldapmodule) {
    $status[] = array(
      'title' => $ldapmodule,
      value => $info[$ldapmodule]['text'],
      'severity' => "0",
    );
  }
  return $status;
}