From d8d44e587f129642357c671cabdead1befe67bf0 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Mon, 11 Apr 2011 10:47:49 -0400
Subject: [PATCH 1/2] Issue #1055856 by catch, clean up installer strace.

---
 includes/bootstrap.inc    |    9 ++++-----
 includes/install.core.inc |    5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index fe1741d..03ce469 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -394,8 +394,9 @@ function conf_path($require_settings = TRUE, $reset = FALSE) {
   for ($i = count($uri) - 1; $i > 0; $i--) {
     for ($j = count($server); $j > 0; $j--) {
       $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
-      if (isset($sites[$dir]) && file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $sites[$dir])) {
-        $dir = $sites[$dir];
+      if (isset($sites[$dir])) {
+        $conf = "$confdir/$sites[$dir]";
+        return $conf;
       }
       if (file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $dir . '/settings.php') || (!$require_settings && file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $dir))) {
         $conf = "$confdir/$dir";
@@ -549,9 +550,7 @@ function drupal_settings_initialize() {
   global $databases, $cookie_domain, $conf, $installed_profile, $update_free_access, $db_url, $db_prefix, $drupal_hash_salt, $is_https, $base_secure_url, $base_insecure_url;
   $conf = array();
 
-  if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
-    include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
-  }
+  include DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
   $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
 
   if (isset($base_url)) {
diff --git a/includes/install.core.inc b/includes/install.core.inc
index a74dfdf..dcdb499 100644
--- a/includes/install.core.inc
+++ b/includes/install.core.inc
@@ -234,8 +234,9 @@ function install_begin_request(&$install_state) {
     header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
     exit;
   }
-
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
+  if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
+  }
 
   // This must go after drupal_bootstrap(), which unsets globals!
   global $conf;
-- 
1.7.1


From 80ccdd3f3f33d82416d4859200fd11ad559fff18 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Mon, 11 Apr 2011 14:13:02 -0400
Subject: [PATCH 2/2] Issue #1123628 by pillarsdotnet: Convert d6 database settings to d7.

---
 includes/install.core.inc |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/includes/install.core.inc b/includes/install.core.inc
index dcdb499..d21ff9f 100644
--- a/includes/install.core.inc
+++ b/includes/install.core.inc
@@ -799,8 +799,29 @@ function install_verify_completed_task() {
  * Verifies the existing settings in settings.php.
  */
 function install_verify_settings() {
-  global $databases;
+  global $databases, $db_url;
 
+  if ( empty($databases)
+    && !empty($db_url)
+    && preg_match('#([^:]+)://([^:]+):([^@]+)@([^/:]+)(:([^/]+))?/(.*)#',
+      $db_url, $matches
+    )
+  ) {
+    // Try forward-porting info from d6 to d7 format.
+    $databases = array(
+      'default' => array(
+        'default' => array(
+          'database' => $matches[7],
+          'username' => $matches[2],
+          'password' => $matches[3],
+          'host' => $matches[4],
+          'port' => $matches[6],
+          'driver' => ($matches[1] == 'mysqli' ? 'mysql' : $matches[1]),
+          'prefix' => $GLOBALS['db_prefix'],
+        ),
+      ),
+    );
+  }
   // Verify existing settings (if any).
   if (!empty($databases) && install_verify_pdo()) {
     $database = $databases['default']['default'];
-- 
1.7.1

