Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 1f69df1f13c4d22fcb93c8388906341ba1564d14..bf6500a738f9edbbc36ae36bec6b0416b0583270 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -880,7 +880,13 @@ function _drush_bootstrap_drupal_configuration() {
if (is_array($url)) {
$url = $url['default'];
}
+ drush_log(dt('DEBUG DRUSH_DB_CREDENTIALS A @url', array('@url' => $url)));
+ if (preg_match("/@:3306/", $url)) {
+ $url = str_replace('@:3306', '@localhost:3306', $url);
+ }
+ drush_log(dt('DEBUG DRUSH_DB_CREDENTIALS B @url', array('@url' => $url)));
$parts = parse_url($url);
+ $parts = !empty($parts) ? $parts : array();
$parts += array('pass' => '', 'port' => '');
$creds['driver'] = $parts['scheme'];
$creds['user'] = urldecode($parts['user']);
@@ -888,6 +894,9 @@ function _drush_bootstrap_drupal_configuration() {
$creds['port'] = $parts['port'];
$creds['pass'] = urldecode($parts['pass']);
$creds['name'] = trim($parts['path'], '/');
+ $creds['port'] = !empty($creds['port']) ? $creds['port'] : '3306';
+ $creds['host'] = !empty($creds['host']) ? $creds['host'] : 'localhost';
+ $creds['driver'] = !empty($creds['driver']) ? $creds['driver'] : 'mysqli';
}
break;
case 7:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment