From 14d0557487455ab884c3088bee8c68a8ddf88b37 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg 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: https://develop.svn.wordpress.org/trunk@758 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 cdf7f750b2..6cccfefe73 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)) {