Commit 73fba35c authored by Adrian Rossouw's avatar Adrian Rossouw

This seems to resolve #907248 - aegir forces default profile.

parent 792c3a48
......@@ -31,7 +31,12 @@ function drush_provision_drupal_post_provision_import() {
// generate the drushrc
provision_save_site_data();
// Do not automatically save the drushrc at the end of the command.
drush_set_option('provision_save_config', false);
provision_backend_invoke(d()->name, 'provision-verify');
provision_reload_config('site');
}
}
......@@ -56,7 +56,7 @@ function provision_drupal_drush_exit() {
$command = drush_get_command();
$command = explode(" ", $command['command']);
if (preg_match("/^provision-/", $command[0])) {
if (preg_match("/^provision-/", $command[0]) && drush_get_option('provision_save_config', TRUE)) {
if (d()->type === 'site') {
if (drush_get_option('installed')) {
// Don't generate the drushrc.php on provision-save/delete commands.
......@@ -619,3 +619,25 @@ function provision_prepare_environment() {
$_SERVER['db_type'] = ($_SERVER['db_type'] == 'mysqli') ? 'mysql' : $_SERVER['db_type'];
}
}
/**
* Reload drushrc files (if available) from several possible locations.
*
* Because the base drush_load_config method only uses an include_once,
* we run into issues when provision commands call other commands that
* modify these config files.
*
* 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);
if (file_exists($file)) {
include($file);
if (sizeof($options)) {
$options = array_merge(drush_get_context($context, array()), $options);
drush_set_context($context, $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