You are here

function hosting_https_get_servers in Aegir HTTPS 7.3

Return a list of servers which have HTTPS enabled web services.

3 calls to hosting_https_get_servers()
hosting_https_get_platforms in ./hosting_https.module
Return a list of platforms on HTTPS enabled servers.
hosting_https_is_available in ./hosting_https.module
hosting_https_site_form_validate in ./hosting_https.nodeapi.inc
Site form validation callback.

File

./hosting_https.module, line 39
Hook implementations for the Hosting HTTPS module.

Code

function hosting_https_get_servers($access_check = TRUE) {
  $servers = hosting_get_servers('http', $access_check);
  $https_servers = array();
  foreach ($servers as $nid => $title) {
    $server = node_load($nid);
    $check_servers = array();
    if ($server->services['http']->type == 'cluster') {
      foreach ($server->services['http']->web_servers as $inner_nid) {
        $check_servers[] = node_load($inner_nid);
      }
    }
    elseif ($server->services['http']->type == 'pack') {
      foreach ($server->services['http']->master_servers as $inner_nid) {
        $check_servers[] = node_load($inner_nid);
      }
      foreach ($server->services['http']->slave_servers as $inner_nid) {
        $check_servers[] = node_load($inner_nid);
      }
    }
    else {
      $check_servers[] = $server;
    }
    $https_available = TRUE;
    foreach ($check_servers as $node) {

      // For clusters and packs, HTTPS is only available if *all* of its servers
      // have HTTPS enabled.
      $https_available = $https_available && $node->services['http']->https_enabled;
    }
    if ($https_available) {
      $https_servers[] = $nid;
    }
  }
  return $https_servers;
}