You are here

function drush_hosting_alias_pre_hosting_task in Hosting 7.4

Same name and namespace in other branches
  1. 5 alias/hosting_alias.drush.inc \drush_hosting_alias_pre_hosting_task()
  2. 6.2 alias/hosting_alias.drush.inc \drush_hosting_alias_pre_hosting_task()
  3. 7.3 alias/hosting_alias.drush.inc \drush_hosting_alias_pre_hosting_task()

@file Drush include for the hosting_alias module.

File

alias/hosting_alias.drush.inc, line 7
Drush include for the hosting_alias module.

Code

function drush_hosting_alias_pre_hosting_task() {
  if (module_exists('hosting_alias')) {
    $task =& drush_get_context('HOSTING_TASK');
    if ($task->ref->type == 'site') {
      $aliases = implode(',', hosting_alias_get_aliases($task->ref));
      $task->context_options['aliases'] = $aliases ? $aliases : 'null';
      $redirection = db_query("SELECT redirection FROM {hosting_site_alias} WHERE vid = :vid", array(
        ':vid' => $task->ref->vid,
      ))
        ->fetchField();
      $task->context_options['redirection'] = $redirection ? $redirection : 'null';
    }
  }
}