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
This commit is contained in:
saxmatt 2004-01-12 10:18:25 +00:00
parent 7c9878d797
commit 28b6f1b414
1 changed files with 17 additions and 9 deletions

View File

@ -1,6 +1,13 @@
<?php
$_wp_installing = 1;
if (file_exists('../wp-config.php')) die("The file 'wp-config.php already exists. If you need to reset any of the configuration items in this file, please delete it first.");
if (file_exists('../wp-config.php'))
die("The file 'wp-config.php already exists. If you need to reset any of the configuration items in this file, please delete it first.");
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.');
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.");
$step = $HTTP_GET_VARS['step'];
if (!$step) $step = 0;
@ -43,7 +50,6 @@ if (!$step) $step = 0;
<?php
switch($step) {
case 0:
?>
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
@ -103,12 +109,14 @@ switch($step) {
$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');
// Test the db connection.
define('DB_NAME', $dbname);
define('DB_USER', $uname);
define('DB_PASSWORD', $passwrd);
define('DB_HOST', $dbhost);
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');
// 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)) {