Skip to content

Instantly share code, notes, and snippets.

@nevergone
Created October 24, 2020 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevergone/b3071593ad1c953fc09f7f19b361cbc5 to your computer and use it in GitHub Desktop.
Save nevergone/b3071593ad1c953fc09f7f19b361cbc5 to your computer and use it in GitHub Desktop.
Drush 4.x - DRUSH_OPTIONS_URI__variable.patch
diff --git a/commands/core/drupal/site_install_6.inc b/commands/core/drupal/site_install_6.inc
index 21424fb9b..d88110b54 100644
--- a/commands/core/drupal/site_install_6.inc
+++ b/commands/core/drupal/site_install_6.inc
@@ -18,7 +18,7 @@ function drush_core_site_install_version($profile) {
$cli_output = drush_shell_exec_output();
$cli_cookie = end($cli_output);
- // We need to bootstrap the database to be able to check the progress of the
+ // We need to bootstrap the database to be able to check the progress of the
// install batch process since we're not duplicating the install process using
// drush_batch functions, but calling the process directly.
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_DATABASE);
@@ -97,6 +97,9 @@ function _drush_site_install6_stage($profile, $cli_cookie, $initial_op) {
*/
function _drush_site_install6_cookies($profile, $cookie = NULL) {
$drupal_base_url = parse_url(drush_get_option('uri', 'http://default'));
+ if ($drupal_base_url['host'] === 'default' && getenv('DRUSH_OPTIONS_URI')) {
+ $drupal_base_url = parse_url(getenv('DRUSH_OPTIONS_URI'));
+ }
$output = '$_GET=array("profile"=>"' . $profile . '", "locale"=>"' . drush_get_option('locale', 'en') . '", "id"=>"1"); $_REQUEST=&$_GET;';
$output .= 'define("DRUSH_SITE_INSTALL6", TRUE);$_SERVER["SERVER_SOFTWARE"] = NULL;';
$output .= '$_SERVER["SCRIPT_NAME"] = "/install.php";';
diff --git a/includes/environment.inc b/includes/environment.inc
index a0d0eed12..110aa63c7 100644
--- a/includes/environment.inc
+++ b/includes/environment.inc
@@ -765,6 +765,10 @@ function _drush_bootstrap_drupal_site_validate() {
$site_path = drush_site_path();
$elements = explode('/', $site_path);
$current = array_pop($elements);
+ if (getenv('DRUSH_OPTIONS_URI')) {
+ $parsed_url = parse_url(getenv('DRUSH_OPTIONS_URI'));
+ $current = $parsed_url['host'];
+ }
if (!$current) {
$current = 'default';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment