mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Set error if there is a problem connecting to the DB. Props skeltoac and Potter_System. fixes #5495
git-svn-id: http://svn.automattic.com/wordpress/trunk@6426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4f92b64b2e
commit
de5340b9f3
@ -13,6 +13,7 @@ if (isset($_GET['step']))
|
|||||||
$step = $_GET['step'];
|
$step = $_GET['step'];
|
||||||
else
|
else
|
||||||
$step = 0;
|
$step = 0;
|
||||||
|
function display_header(){
|
||||||
header( 'Content-Type: text/html; charset=utf-8' );
|
header( 'Content-Type: text/html; charset=utf-8' );
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
@ -24,13 +25,17 @@ header( 'Content-Type: text/html; charset=utf-8' );
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
}//end function display_header();
|
||||||
|
|
||||||
// Let's check to make sure WP isn't already installed.
|
// Let's check to make sure WP isn't already installed.
|
||||||
if ( is_blog_installed() ) die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
|
if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
|
||||||
|
|
||||||
switch($step) {
|
switch($step) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1: // in case people are directly linking to this
|
case 1: // in case people are directly linking to this
|
||||||
|
display_header();
|
||||||
?>
|
?>
|
||||||
<h1><?php _e('Welcome'); ?></h1>
|
<h1><?php _e('Welcome'); ?></h1>
|
||||||
<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
|
<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
|
||||||
@ -61,6 +66,9 @@ switch($step) {
|
|||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
if ( !empty($wpdb->error) )
|
||||||
|
wp_die($wpdb->error->get_error_message());
|
||||||
|
display_header();
|
||||||
// Fill in the data we gathered
|
// Fill in the data we gathered
|
||||||
$weblog_title = stripslashes($_POST['weblog_title']);
|
$weblog_title = stripslashes($_POST['weblog_title']);
|
||||||
$admin_email = stripslashes($_POST['admin_email']);
|
$admin_email = stripslashes($_POST['admin_email']);
|
||||||
|
@ -6,6 +6,7 @@ define('WPINC', 'wp-includes');
|
|||||||
|
|
||||||
require_once('../wp-includes/compat.php');
|
require_once('../wp-includes/compat.php');
|
||||||
require_once('../wp-includes/functions.php');
|
require_once('../wp-includes/functions.php');
|
||||||
|
require_once('../wp-includes/classes.php');
|
||||||
|
|
||||||
if (!file_exists('../wp-config-sample.php'))
|
if (!file_exists('../wp-config-sample.php'))
|
||||||
wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
||||||
@ -164,6 +165,9 @@ switch($step) {
|
|||||||
|
|
||||||
// We'll fail here if the values are no good.
|
// We'll fail here if the values are no good.
|
||||||
require_wp_db();
|
require_wp_db();
|
||||||
|
if ( !empty($wpdb->error) )
|
||||||
|
wp_die($wpdb->error->get_error_message());
|
||||||
|
|
||||||
$handle = fopen('../wp-config.php', 'w');
|
$handle = fopen('../wp-config.php', 'w');
|
||||||
|
|
||||||
foreach ($configFile as $line_num => $line) {
|
foreach ($configFile as $line_num => $line) {
|
||||||
|
@ -115,6 +115,7 @@ class wpdb {
|
|||||||
<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>
|
<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Are you sure it exists?</li>
|
<li>Are you sure it exists?</li>
|
||||||
|
<li>Does the user <code>".DB_USER."</code> have permission to use the <code>$db</code> database?</li>
|
||||||
<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
|
<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
|
<p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
|
||||||
@ -462,10 +463,16 @@ class wpdb {
|
|||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
function bail($message) { // Just wraps errors in a nice header and footer
|
function bail($message) { // Just wraps errors in a nice header and footer
|
||||||
if ( !$this->show_errors )
|
if ( !$this->show_errors ) {
|
||||||
|
if ( class_exists('WP_Error') )
|
||||||
|
$this->error = new WP_Error('500', $message);
|
||||||
|
else
|
||||||
|
$this->error = $message;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
wp_die($message);
|
wp_die($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks wether of not the database version is high enough to support the features WordPress uses
|
* Checks wether of not the database version is high enough to support the features WordPress uses
|
||||||
* @global $wp_version
|
* @global $wp_version
|
||||||
|
Loading…
Reference in New Issue
Block a user