You are here

function hosting_get_db_server in Hosting 5

Same name and namespace in other branches
  1. 6.2 db_server/hosting_db_server.module \hosting_get_db_server()
  2. 7.4 db_server/hosting_db_server.module \hosting_get_db_server()
  3. 7.3 db_server/hosting_db_server.module \hosting_get_db_server()
1 call to hosting_get_db_server()
hosting_import_site in site/hosting_site.module
Helper function to generate new site node during import

File

db_server/hosting_db_server.module, line 39

Code

function hosting_get_db_server($hostname, $web_server = null) {
  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='db_server'", $ip, $hostname));
  if ($result) {
    return node_load($result);
  }
  return false;
}