You are here

function hosting_server_ip_allocate in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 server/hosting.ip.inc \hosting_server_ip_allocate()
  2. 7.4 server/hosting.ip.inc \hosting_server_ip_allocate()

Allocate a single IP for a single server.

XXX: this should be in the 'server' class (which doesn't exist yet) or at least in the services class

Parameters

int $server: The server node ID.

Return value

int Id of the next available IP.

1 call to hosting_server_ip_allocate()
hosting_ip_allocate in server/hosting.ip.inc
Allocate an IP for a given site on a given server.

File

server/hosting.ip.inc, line 176
General IP address CRUD routines.

Code

function hosting_server_ip_allocate($server) {

  // guess the next available IP
  return db_query("SELECT hosting_ip_addresses.id\n                   FROM {hosting_ip_addresses}\n                     LEFT JOIN {hosting_ssl_cert_ips}\n                       ON (hosting_ip_addresses.id = hosting_ssl_cert_ips.ip_address)\n                   WHERE hosting_ssl_cert_ips.ip_address IS NULL\n                     AND nid = :nid LIMIT 1;", array(
    ':nid' => $server,
  ))
    ->fetchField();
}