function hosting_alias_allow_domain

7.x-3.x hosting_alias.module hosting_alias_allow_domain($url, $params = array())

Implements hook_allow_domain().

This function will check the existing aliases and the automatically generated aliases to ensure that this url has not been used before

1 call to hosting_alias_allow_domain()
hosting_subdirs_validate_alias in subdirs/hosting_subdirs.module
Ensure that an alias is valid for subdir site.


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


function hosting_alias_allow_domain($url, $params = array()) {
  $query = db_select('node', 'n')->fields('n', array('nid'))->condition('n.type', 'site');

  $query->leftJoin('hosting_site', 'h', 'h.nid = n.nid');
  $query->condition('h.status', HOSTING_SITE_DELETED, '<>');

  $query->leftJoin('hosting_site_alias', 'a', 'n.vid = a.vid');
  $query->condition('a.alias', $url);

  // For existing sites, don't match the site's current aliases.
  if (isset($params['nid'])) {
    $query->condition('n.nid', $params['nid'], '<>');
  return !$query->countQuery()->execute()->fetchField();