migrate.hostmaster.inc 1.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php

/**
 * @file manual site migrate system
 */

function drush_provision_hostmaster_migrate_validate($site, $platform) {
  // verify the target platform:
  $data = drush_get_merged_options(); // XXX: necessary because the remote
                                      // platform may not have been
                                      // initialised by the frontend (this
                                      // should be checked instead)
  $data['root'] = $platform;
  $data['r'] = $platform;
  drush_backend_invoke('provision verify', $data);
  // verify the current platform
  drush_backend_invoke('provision verify', array('root' => drush_get_option(array('r', 'root'), drush_locate_root())));
  // verify the site prior to migration
  drush_backend_invoke('provision verify', array($site));
}

function drush_provision_pre_hostmaster_migrate($site, $platform) {
23 24 25 26 27 28 29
  if (!drush_confirm("This command will replace your crontab entry. continue?")) {
    drush_set_error('PROVISION_CANCEL_MIGRATE', 'Cancelling');
  }
  // wipe out cron entry
  exec('crontab -r');

  // we can't rely on the park command to exist in pre-0.4 alpha 2 releases
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
  drush_backend_invoke('hostmaster park', array($site, 'uri' => $site));
}

function drush_provision_hostmaster_migrate($site, $platform) { 
  drush_backend_invoke('provision clone', array($site, $site, $platform));
}

function drush_provision_hostmaster_migrate_rollback($site, $platform) {
  drush_backend_invoke('provision delete ', array($site, 'root' => $platform));
}

function drush_provision_post_hostmaster_migrate($site, $platform) {
  drush_backend_invoke('hostmaster unpark', array($site, 'uri' => $site, 'root' => $platform));
  if (!drush_get_error()) {
    drush_backend_invoke('provision delete', array($site));
    drush_backend_invoke('provision verify', array($site, 'root' => $platform, 'publish_path' => $platform));
  }
}