Commit 0a06e64b authored by Adrian Rossouw's avatar Adrian Rossouw

More fixes relating to #907248 .. ensure that the migrated site returns the...

More fixes relating to #907248 .. ensure that the migrated site returns the new values from the config.
parent 73fba35c
......@@ -24,17 +24,21 @@ function drush_provision_drupal_pre_provision_migrate($platform, $new_uri = null
drush_invoke('provision-backup');
drush_set_option('old_platform', d()->platform->name);
if (d()->platform->name == $platform) {
// deploying over existing site.
drush_set_option('deploy_replace_site', TRUE);
}
// If we are renaming the site, pick this up early.
if (!is_null($new_uri) && ($new_uri != d()->uri)) {
drush_set_option('target_name', $new_uri);
}
else {
// the site url stays the same
drush_set_option('target_name', d()->name);
// The platform stays the same
if (d()->platform->name == $platform) {
drush_log('Replacing the existing site on the same platform');
// deploying over existing site.
drush_set_option('deploy_replace_site', TRUE);
}
}
}
......@@ -64,6 +68,8 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = null) {
$options = array();
$options['uri'] = d()->uri;
if (!is_null($new_uri) && ($new_uri != d()->uri)) {
$options = d()->options;
$options['uri'] = ltrim($new_uri, '@');
......@@ -80,9 +86,12 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = null) {
$options['db_server'] = $db_server;
}
drush_set_option('new_site_path', "{$options['root']}/sites/{$options['uri']}");
drush_backend_invoke_args('provision-save', array($target), $options);
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
if (!drush_get_error()) {
drush_set_option('provision_save_config', false);
provision_backend_invoke($target, 'provision-verify');
}
}
......@@ -115,6 +124,8 @@ function drush_provision_drupal_post_provision_migrate($platform, $new_uri = nul
$config = new provisionConfig_drushrc_alias(d()->name);
$config->unlink();
}
}
// Load the config file of the newly migrated site and return it to hosting.
provision_reload_config('site', drush_get_option('new_site_path', d()->site_path) . '/drushrc.php');
}
......@@ -631,9 +631,10 @@ function provision_prepare_environment() {
* For the changes to become available, and more importantly passed to the
* front end, we need to call this function after calling provision commands.
*/
function provision_reload_config($context) {
$file = _drush_config_file($context);
function provision_reload_config($context, $file = null) {
$file = ($file) ? $file : _drush_config_file($context);
if (file_exists($file)) {
drush_log("Reloading $context drushrc.php from $file");
include($file);
if (sizeof($options)) {
$options = array_merge(drush_get_context($context, array()), $options);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment