You are here

function hosting_ssl_get_ip in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 web_server/ssl/hosting_ssl.nodeapi.inc \hosting_ssl_get_ip()
  2. 7.3 web_server/ssl/hosting_ssl.nodeapi.inc \hosting_ssl_get_ip()

Get an Array of all IP's associated with an SSL certificate.

2 calls to hosting_ssl_get_ip()
hosting_nginx_ssl_hosting_site_context_options in web_server/nginx/ssl/hosting_nginx_ssl.drush.inc
hosting_ssl_hosting_site_context_options in web_server/ssl/hosting_ssl.drush.inc
Implements hook_hosting_TASK_OBJECT_context_options().

File

web_server/ssl/hosting_ssl.nodeapi.inc, line 164
NodeAPI functions for the Hosting SSL module.

Code

function hosting_ssl_get_ip($cid) {
  $result = db_query("SELECT h.name AS server_name, ips.ip_address\n                        FROM {hosting_ssl_cert_ips} cert\n                  INNER JOIN {hosting_ip_addresses} ips\n                          ON cert.ip_address = ips.id\n                  INNER JOIN {hosting_context} h\n                          ON h.nid = ips.nid\n                       WHERE cid = :cid", array(
    ':cid' => $cid,
  ));
  $ip_addresses = array();
  foreach ($result as $record) {
    $ip_addresses[$record->server_name] = $record->ip_address;
  }
  return $ip_addresses;
}