You are here

function hosting_migrate_post_hosting_migrate_task in Hosting 7.3

Same name and namespace in other branches
  1. 5 migrate/hosting_migrate.drush.inc \hosting_migrate_post_hosting_migrate_task()
  2. 6.2 migrate/hosting_migrate.drush.inc \hosting_migrate_post_hosting_migrate_task()
  3. 7.4 migrate/hosting_migrate.drush.inc \hosting_migrate_post_hosting_migrate_task()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

migrate/hosting_migrate.drush.inc, line 60
Implement drush hooks for the hosting migrate module.

Code

function hosting_migrate_post_hosting_migrate_task($task, $data) {
  if ($task->ref->type == 'site') {
    $target = $task->task_args['target_platform'];
    $site = $task->ref;
    if (hosting_site_get_domain($site->title) != hosting_site_get_domain($task->task_args['new_uri'])) {
      $site->title = hosting_site_clean_domain($task->task_args['new_uri']);
      hosting_context_register($site->nid, hosting_site_get_domain($site->title));
    }
    if ($site->db_server != $task->task_args['new_db_server']) {
      $site->db_server = $task->task_args['new_db_server'];
    }
    $site->db_name = $data['context']['db_name'];
    $profile = hosting_package_instance_load(array(
      'i.rid' => $target,
      'p.short_name' => $data['context']['profile'],
    ));
    if ($profile) {
      $site->profile = $profile->package_id;
    }
    $site->verified = REQUEST_TIME;
    $site->no_verify = TRUE;
    $site->platform = $target;
    node_save($site);
    $task->ref = $site;

    //do the package synching
    $context = $data['context'];
    $packages = $context['packages'];
    hosting_package_sync($packages);
    hosting_package_instance_sync($task->ref->nid, $task->ref->type, $packages);

    // Record the backup created during migrate.
    $task->task_args['description'] = t('Pre-migration backup');
    hosting_site_post_hosting_backup_task($task, $data);
  }
}