function hosting_get_servers

7.x-3.x hosting_server.module hosting_get_servers($service)

Get servers providing a service.

Parameters

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

Return value

array 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()

File

server/hosting_server.module, line 717
Hook implementations for the Hosting server module.

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
                      WHERE s.available = 1
                      AND s.service = :service", array(':service' => $service));
  foreach ($result as $server) {
    $return[$server->nid] = $server->title;
  }
  drupal_alter('hosting_servers_titles', $return, $service);
  return $return;
}