You are here

function hosting_get_servers in Hostmaster (Aegir) 6

Get servers providing a service.

Parameters

$service: Service type string, like 'http' or 'db'

Return value

An array of enabled servers, keys are the nid's of the nodes representing them, values are the titles of the servers.

See also

hook_hosting_servers_titles_alter()

13 calls to hosting_get_servers()
hostingService_dns_master::context_options in modules/hosting/dns/hosting_dns.service.inc
hostingService_dns_master::form in modules/hosting/dns/hosting_dns.service.inc
hostingService_dns_master::view in modules/hosting/dns/hosting_dns.service.inc
hostingService_http_cluster::context_options in modules/hosting/web_cluster/hosting_web_cluster.service.inc
hostingService_http_cluster::form in modules/hosting/web_cluster/hosting_web_cluster.service.inc

... See full list

File

modules/hosting/server/hosting_server.module, line 518

Code

function hosting_get_servers($service) {
  $return = array();
  $result = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {hosting_service} s ON n.vid = s.vid AND s.available = 1 AND s.service = '%s'", $service);
  while ($server = db_fetch_object($result)) {
    $return[$server->nid] = $server->title;
  }
  drupal_alter('hosting_servers_titles', $return, $service);
  return $return;
}