You are here

function drush_hosting_subdirs_pre_hosting_task in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 subdirs/hosting_subdirs.drush.inc \drush_hosting_subdirs_pre_hosting_task()

Implements drush_HOOK_pre_COMMAND().

File

subdirs/hosting_subdirs.drush.inc, line 10
Implement drush hooks for the hosting migrate module.

Code

function drush_hosting_subdirs_pre_hosting_task($task) {
  $task =& drush_get_context('HOSTING_TASK');
  if ($task->ref->type == 'site' && $task->task_type == 'migrate') {
    $site = $task->ref;
    if (!_hosting_subdirs_is_a_subdir_site($site)) {
      return;
    }

    // Clean up the automatic subdir alias and redirection, as they'll be
    // re-generated with the new domain.
    $subdir_alias = array_search($site->redirection, $site->aliases);
    unset($site->aliases[$subdir_alias]);
    unset($site->redirection);
  }
}