I have some problem when I want clone a site. If I want copy some fields from origin node is impossible. See the code:

function drush_hosting_clone_pre_hosting_task($task) {
  $task =& drush_get_context('HOSTING_TASK');
  if ($task->ref->type == 'site' && $task->task_type == 'clone') {
    $task->args[2] = '@' . strtolower(trim($task->task_args['new_uri']));
    $platform = node_load($task->task_args['target_platform']);
    $task->args[3] = hosting_context_name($platform->nid);

    $profile_instance = _hosting_migrate_get_target_profile_name($task);

    if (sizeof($profile_instance)) {
      $task->options['profile'] = $profile_instance->short_name;
    }
    else {
      drush_set_error("HOSTING_NO_VALID_PROFILE", dt("There are no valid install profiles on the target platform to migrate to"));
    }

    if ($site->db_server != $task->task_args['new_db_server']) {
      $task->options['new_db_server'] = hosting_context_name($task->task_args['new_db_server']);
    }

    if (module_exists('hosting_alias')) {
      $task->options['aliases'] = str_replace("\n", ",", $task->task_args['aliases']);
      $task->options['redirection'] = $task->task_args['redirection'];
    }
  }
}

I am thinking about call a one hook or add both nodes to task object or similar.

Comments

helmo’s picture

I think your looking for is

$task->ref->nid

That should be the node id of the source site.

anarcat’s picture

Title: Clone site » Clone site overrides
Category: feature » support
Status: Active » Postponed (maintainer needs more info)
ergonlogic’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)

The 6.x-2.x branch will go EOL along with Drupal this week. So I'm closing this issue. If it remains a confirmed issue in 7.x-3.x, feel free to re-open, or better yet, create a new issue referencing this one.