hosting_alias.drush.inc

Drush include for the hosting_alias module.

Functions

File

alias/hosting_alias.drush.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Drush include for the hosting_alias module.
  5. */
  6. function drush_hosting_alias_pre_hosting_task() {
  7. if (module_exists('hosting_alias')) {
  8. $task = &drush_get_context('HOSTING_TASK');
  9. if ($task->ref->type == 'site') {
  10. $aliases = implode(',', hosting_alias_get_aliases($task->ref));
  11. $task->context_options['aliases'] = ($aliases) ? $aliases : 'null';
  12. $redirection = db_query("SELECT redirection FROM {hosting_site_alias} WHERE vid = :vid", array(':vid' => $task->ref->vid))->fetchField();
  13. $task->context_options['redirection'] = ($redirection) ? $redirection : 'null';
  14. }
  15. }
  16. }
  17. /**
  18. * Implements hook_drush_context_import().
  19. *
  20. * If we're importing a site, then import the aliases and redirection values.
  21. */
  22. function hosting_alias_drush_context_import($context, &$node) {
  23. if ($context->type == 'site') {
  24. $node->aliases = $context->aliases;
  25. $node->redirection = $context->redirection;
  26. }
  27. }