Return after bailing since bail doesn't always die now. Don't do queries if constructor didn't complete. see #5495

git-svn-id: http://svn.automattic.com/wordpress/branches/2.3@6458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-12-21 19:28:21 +00:00
parent 4c2206cf4a
commit 054d7612c8
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ class wpdb {
var $last_query;
var $col_info;
var $queries;
var $ready = false;
// Our tables
var $posts;
@ -74,12 +75,14 @@ class wpdb {
</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>
");
return;
}
if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') )
$this->query("SET NAMES '$this->charset'");
$this->select($dbname);
$this->ready = true;
}
function __destruct() {
@ -101,6 +104,7 @@ class wpdb {
<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 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>");
return;
}
}
@ -195,6 +199,9 @@ class wpdb {
// Basic Query - see docs for more detail
function query($query) {
if ( ! $ready )
return false;
// filter the query, if filters are available
// NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
if ( function_exists('apply_filters') )