mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Improved error messages.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
522bf7107b
commit
2d407089c9
@ -40,15 +40,16 @@ class wpdb {
|
||||
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
|
||||
$this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);
|
||||
if (!$this->dbh) {
|
||||
die("<div>
|
||||
<p><strong>Error establishing a database connection!</strong> This probably means that the connection information in your <code>wp-config.php</code> file is incorrect. Double check it and try again.</p>
|
||||
<ul>
|
||||
<li>Are you sure you have the correct user/password?</li>
|
||||
<li>Are you sure that you have typed the correct hostname?</li>
|
||||
<li>Are you sure that the database server is running?</li>
|
||||
</ul>
|
||||
<p><a href='http://wordpress.org/support/'>WordPress Support Forums</a></p>
|
||||
</div>");
|
||||
$this->bail("
|
||||
<h1>Error establishing a database connection</h1>
|
||||
<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>.</p>
|
||||
<ul>
|
||||
<li>Are you sure you have the correct username and password?</li>
|
||||
<li>Are you sure that you have typed the correct hostname?</li>
|
||||
<li>Are you sure that the database server is running?</li>
|
||||
</ul>
|
||||
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
|
||||
");
|
||||
}
|
||||
|
||||
$this->select($dbname);
|
||||
@ -59,14 +60,14 @@ class wpdb {
|
||||
|
||||
function select($db) {
|
||||
if (!@mysql_select_db($db,$this->dbh)) {
|
||||
die("
|
||||
<p>We're having a little trouble selecting the proper database for WordPress.</p>
|
||||
<ul>
|
||||
<li>Are you sure it exists?</li>
|
||||
<li>Your database name is currently specified as <code>" . DB_NAME ."</code>. Is this correct?</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>
|
||||
<p><a href='http://wordpress.org/support/'>WordPress Support Forums</a></p>");
|
||||
$this->bail("
|
||||
<h1>Can’t select database</h1>
|
||||
<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>
|
||||
<li>Are you sure it exists?</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>
|
||||
<p>If you continue to have connection problems you should contact your host. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,6 +277,59 @@ class wpdb {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bail($message) { // Just wraps errors in a nice header and footer
|
||||
echo <<<HEAD
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>WordPress › Installation</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style media="screen" type="text/css">
|
||||
<!--
|
||||
html {
|
||||
background: #eee;
|
||||
}
|
||||
body {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
margin-left: 25%;
|
||||
margin-right: 25%;
|
||||
padding: .2em 2em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #006;
|
||||
font-size: 18px;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
p, li, dt {
|
||||
line-height: 140%;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
padding: 5px 5px 5px 20px;
|
||||
}
|
||||
#logo {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1>
|
||||
HEAD;
|
||||
echo $message;
|
||||
echo "</body></html>";
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
|
||||
|
Loading…
Reference in New Issue
Block a user