function hosting_alias_allow_domain in Hosting 7.3
Same name and namespace in other branches
- 5 alias/hosting_alias.module \hosting_alias_allow_domain()
- 6.2 alias/hosting_alias.module \hosting_alias_allow_domain()
- 7.4 alias/hosting_alias.module \hosting_alias_allow_domain()
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.
File
- alias/
hosting_alias.module, line 589 - Allow sites to have domain aliases that they can be accessed with.
Code
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();
}