You are here

function hosting_alias_get_aliases in Hostmaster (Aegir) 6

Retrieve a list of aliases for a site.

Parameters

$node: The site to get the aliases for.

$type: Restrict the type of aliases returned, defaults to returning all aliases. Should be one of:

Return value

An array of aliases for the given site.

3 calls to hosting_alias_get_aliases()
drush_hosting_alias_pre_hosting_task in modules/hosting/alias/hosting_alias.drush.inc
@file Drush include for the hosting_alias module.
hosting_alias_form_data in modules/hosting/alias/hosting_alias.module
Alter the node form for a site to add the aliases and redirection items.
hosting_alias_nodeapi in modules/hosting/alias/hosting_alias.module
Implementation of hook_nodeapi().

File

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

Code

function hosting_alias_get_aliases($node, $type = null) {
  if (!$node->vid) {
    return array();
  }
  $alias = array();
  $query = "SELECT alias FROM {hosting_site_alias} WHERE vid=%d";
  $args[] = $node->vid;
  if (!is_null($type)) {
    $query .= " AND automatic=%d";
    $args[] = $type;
  }
  $query .= ' ORDER BY alias ASC';
  $result = db_query($query, $args);
  while ($obj = db_fetch_object($result)) {
    $alias[] = $obj->alias;
  }
  if (sizeof($alias)) {
    return $alias;
  }
  return array();
}