function hosting_get_servers in Hosting 7.4
Same name and namespace in other branches
- 6.2 server/hosting_server.module \hosting_get_servers()
- 7.3 server/hosting_server.module \hosting_get_servers()
Get servers providing a service.
Parameters
string $service: Service type string, like 'http' or 'db'
bool $node_access: Apply node access filters, defaults to TRUE.
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()
14 calls to hosting_get_servers()
- hostingService_http_cluster::context_options in web_cluster/
hosting_web_cluster.service.inc - hostingService_http_cluster::form in web_cluster/
hosting_web_cluster.service.inc - hostingService_http_cluster::view in web_cluster/
hosting_web_cluster.service.inc - hostingService_http_pack::context_options in web_pack/
hosting_web_pack.service.inc - hostingService_http_pack::form in web_pack/
hosting_web_pack.service.inc
File
- server/
hosting_server.module, line 813
Code
function hosting_get_servers($service, $node_access = TRUE) {
$return = array();
$query = db_select('node', 'n');
$query
->join('hosting_service', 's', 'n.vid = s.vid');
$query
->fields('n', array(
'nid',
'title',
))
->condition('s.available', '1')
->condition('s.service', $service);
if ($node_access) {
$query
->addTag('node_access');
}
$result = $query
->execute();
foreach ($result as $server) {
$return[$server->nid] = $server->title;
}
drupal_alter('hosting_servers_titles', $return, $service);
return $return;
}