From 28b6f1b414f622a5a5ba93e5282f543181bc8aa4 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Mon, 12 Jan 2004 10:18:25 +0000 Subject: [PATCH] Updates from Ryan to check for errors earlier in script and test DB connection. git-svn-id: http://svn.automattic.com/wordpress/trunk@758 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/install-config.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/wp-admin/install-config.php b/wp-admin/install-config.php index cdf7f750b..6cccfefe7 100644 --- a/wp-admin/install-config.php +++ b/wp-admin/install-config.php @@ -1,6 +1,13 @@

Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.

@@ -102,13 +108,15 @@ switch($step) { $dbhost = $HTTP_POST_VARS['dbhost']; $prefix = $HTTP_POST_VARS['prefix']; if (empty($prefix)) $prefix = 'wp_'; - - if (!file_exists('../wp-config-sample.php')) - die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); - $configFile = file('../wp-config-sample.php'); - - if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually."); - $handle = fopen('../wp-config.php', 'w'); + + // Test the db connection. + define('DB_NAME', $dbname); + define('DB_USER', $uname); + define('DB_PASSWORD', $passwrd); + define('DB_HOST', $dbhost); + + // We'll fail here if the values are no good. + require_once('../wp-includes/wp-db.php'); foreach ($configFile as $line_num => $line) { switch (substr($line,0,16)) {