function hosting_get_db_server in Hosting 6.2
Same name and namespace in other branches
- 5 db_server/hosting_db_server.module \hosting_get_db_server()
- 7.4 db_server/hosting_db_server.module \hosting_get_db_server()
- 7.3 db_server/hosting_db_server.module \hosting_get_db_server()
Find the database server.
File
- db_server/
hosting_db_server.module, line 30 - Allow Hostmaster to configure database servers.
Code
function hosting_get_db_server($hostname) {
if (_hosting_valid_ip($hostname)) {
$ip = $hostname;
$hostname = gethostbyaddr($hostname);
}
else {
$ip = gethostbyname($hostname);
}
$result = db_result(db_query("SELECT nid FROM {node} WHERE title in ('%s', '%s') and type='server'", $ip, $hostname));
if ($result) {
return node_load($result);
}
return false;
}