migrate.hostmaster.inc 1.65 KB
Newer Older
1 2 3 4 5 6 7 8
<?php

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

function drush_provision_hostmaster_migrate_validate($site, $platform) {
  // verify the target platform:
9 10 11 12 13 14 15 16 17 18
  if (!is_dir($platform)) {
    drush_print("The platform path you specified does not exist yet.");
    drush_print("Downloading the hostmaster front end. (this might take a few minutes)");
    drush_backend_invoke('make', array(dirname(__FILE__) . '/aegir.make', $platform));
    if (drush_get_error()) {
      drush_log("The hostmaster front end could not be downloaded, exiting.", "error");
    }
  }

  $data = drush_get_merged_options(); 
19
  $data['r'] = $data['root'] = realpath($platform);
20
  drush_backend_invoke('provision-verify', $data);
21
  // verify the current platform
22
  drush_backend_invoke('provision-verify', array('root' => drush_get_option(array('r', 'root'), drush_locate_root())));
23
  // verify the site prior to migration
24
  drush_backend_invoke('provision-verify', array($site));
25 26 27
}

function drush_provision_pre_hostmaster_migrate($site, $platform) {
28
  if (!drush_confirm("This command will replace your crontab entry. continue?")) {
29
    return drush_set_error('PROVISION_CANCEL_MIGRATE', 'Cancelling');
30 31 32 33 34
  }
  // wipe out cron entry
  exec('crontab -r');

  // we can't rely on the park command to exist in pre-0.4 alpha 2 releases
35
  drush_backend_invoke('hostmaster-pause', array($site, 'uri' => $site));
36 37 38
}

function drush_provision_hostmaster_migrate($site, $platform) { 
39
  drush_backend_invoke('provision-migrate', array($site, $platform));
40 41 42
}

function drush_provision_post_hostmaster_migrate($site, $platform) {
43
  drush_backend_invoke('hostmaster-resume', array($site, 'uri' => $site, 'root' => $platform));
44 45
}