[wp-cvs] wordpress/wp-includes wp-db.php,1.12,1.13

Matthew Mullenweg saxmatt at users.sourceforge.net
Fri Jul 23 01:35:59 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10755/wp-includes

Modified Files:
	wp-db.php 
Log Message:
Improved error messages.

Index: wp-db.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/wp-db.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** wp-db.php	24 May 2004 08:22:18 -0000	1.12
--- wp-db.php	23 Jul 2004 01:35:56 -0000	1.13
***************
*** 41,53 ****
  		$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>");
  		}
  
--- 41,54 ----
  		$this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);
  		if (!$this->dbh) {
! 			$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>
! ");
  		}
  
***************
*** 60,71 ****
  	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>");
  		}
  	}
--- 61,72 ----
  	function select($db) {
  		if (!@mysql_select_db($db,$this->dbh)) {
! 			$this->bail("
! <h1>Can&#8217;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>");
  		}
  	}
***************
*** 277,280 ****
--- 278,334 ----
  		}
  	}
+ 
+ 	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 &rsaquo; 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();
+ 	}
  }
  




More information about the cvs mailing list