From bc60d451e5156330fff965921e2eba4cc8b02980 Mon Sep 17 00:00:00 2001 From: sminnee Date: Wed, 13 Oct 2010 04:28:30 +0000 Subject: [PATCH] BUGFIX #5326: Fix installation when using _ss_environment.php (from r102087) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112227 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- install.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index b053730..403c9ee 100644 --- a/install.php +++ b/install.php @@ -84,7 +84,9 @@ foreach(DatabaseAdapterRegistry::get_adapters() as $class => $details) { // Load database config if(isset($_REQUEST['db'])) { - $type = (isset($_REQUEST['db']['type'])) ? $_REQUEST['db']['type'] : "MySQLDatabase"; + if(isset($_REQUEST['db']['type'])) $type = $_REQUEST['db']['type']; + else $type = $_REQUEST['db']['type'] = defined('SS_DATABASE_CLASS') ? SS_DATABASE_CLASS : 'MySQLDatabase'; + // Disabled inputs don't submit anything - we need to use the environment (except the database name) if($usingEnv) { $_REQUEST['db'][$type] = $databaseConfig = array( @@ -94,6 +96,7 @@ if(isset($_REQUEST['db'])) { "password" => defined('SS_DATABASE_PASSWORD') ? SS_DATABASE_PASSWORD : "", "database" => $_REQUEST['db'][$type]['database'], ); + } else { // Normal behaviour without the environment $databaseConfig = $_REQUEST['db'][$type]; @@ -901,10 +904,17 @@ class Installer extends InstallRequirements { $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; $type = $config['db']['type']; $dbConfig = $config['db'][$type]; + if(!$dbConfig) { + echo "

Bad config submitted

";
+			print_r($config);
+			echo "
"; + die(); + } // Write the config file global $usingEnv; if($usingEnv) { + $this->statusMessage("Setting up 'mysite/_config.php' for use with _ss_environment.php..."); $this->writeToFile("mysite/_config.php", <<statusMessage("Setting up 'mysite/_config.php'...");