You are here

function hosting_alias_count_sites in Hostmaster (Aegir) 6

Count the number of sites using a particular URL.

Deprecated

This is essentially !hosting_alias_allow_domain().

File

modules/hosting/alias/hosting_alias.module, line 358
Allow sites to have domain aliases that they can be accessed with.

Code

function hosting_alias_count_sites($url, $params = array()) {
  $query = "SELECT COUNT(n.nid) FROM {node} n \n      LEFT JOIN {hosting_site} h ON h.nid=n.nid \n      LEFT JOIN {hosting_site_alias} a  ON n.vid = a.vid \n    WHERE \n      type='site' AND alias='%s' AND h.status <> %d";
  $args[] = $url;
  $args[] = HOSTING_SITE_DELETED;
  if (isset($params['nid'])) {
    $query .= ' AND n.nid <> %d';
    $args[] = $params['nid'];
  }
  return db_result(db_query($query, $args));
}