Get Drupal database connection settings to prefill form
authorWilliam Mortada <william@mortada.co.uk>
Wed, 11 Oct 2017 19:18:18 +0000 (20:18 +0100)
committerWilliam Mortada <william@mortada.co.uk>
Wed, 11 Oct 2017 19:18:18 +0000 (20:18 +0100)
install/index.php

index 1beae84ffed1e14f5862b17371213fbdb5a48c4a..fd22adbf1a053f78f3efce7205f6578ec931fe54 100644 (file)
@@ -267,6 +267,9 @@ if ($installType == 'drupal') {
     }
   }
 
+  // Bootstrap Drupal to get settings
+  drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
+
   if (!defined('VERSION') or version_compare(VERSION, '6.0') < 0) {
     $errorTitle = ts("Oops! Incorrect Drupal version");
     $errorMsg = ts("This version of CiviCRM can only be used with Drupal 6.x or 7.x. Please ensure that '%1' exists if you are running Drupal 7.0 and over.", array(1 => implode("' or '", $drupalVersionFiles)));
@@ -345,10 +348,10 @@ if ($installType == 'drupal') {
     }
     else {
         $drupalConfig = array(
-            "server" => "localhost",
-            "username" => "drupal",
-            "password" => "",
-            "database" => "drupal",
+            "server" => $databases['default']['default']['host'],
+            "username" => $databases['default']['default']['username'],
+            "password" => $databases['default']['default']['password'],
+            "database" => $databases['default']['default']['database'],
         );
     }
 }