Skip to content

Commit

Permalink
Fixes #4594: When installing Drupal6, properly respect an existing db…
Browse files Browse the repository at this point in the history
… setting (db_url) in settings.php. (#4597)
  • Loading branch information
attilafekete committed Dec 4, 2020
1 parent af1a719 commit d229d6e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion commands/core/site_install.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ function drush_core_pre_site_install($profile = NULL) {

function _drush_core_site_install_add_db_url_to_settings($settingsfile, $db_spec) {
$settingsContents = file_get_contents($settingsfile);
if (preg_match('#^.db_url *=#', $settingsContents)) {
// There's no need to write $db_url if it's already set.
// The regexp below will allow one arbitrary character before $db_url.
// Allowing more/unlimited chars would be unwise as it would match $db_url
// occurrences inside comments.
if (preg_match('#^.?\$db_url *=#m', $settingsContents)) {
return true;
}
// On D6, we have to write $db_url ourselves. In D7+, the installer does it.
Expand Down

0 comments on commit d229d6e

Please sign in to comment.