Always include wp-db.php. Prevents a conditional include and allows db dropins to cleanly extend the wpdb class. Move require_wp_db() to load.php for consistency with bootloader helpers. fixes #14508.

git-svn-id: https://develop.svn.wordpress.org/trunk@15638 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-09-20 19:13:47 +00:00
parent 5207524203
commit 5963feeca6
4 changed files with 24 additions and 27 deletions
+23
View File
@@ -307,6 +307,29 @@ function wp_set_lang_dir() {
}
}
/**
* Load the correct database class file.
*
* This function is used to load the database class file either at runtime or by
* wp-admin/setup-config.php. We must globalize $wpdb to ensure that it is
* defined globally by the inline code in wp-db.php.
*
* @since 2.5.0
* @global $wpdb WordPress Database Object
*/
function require_wp_db() {
global $wpdb;
require_once( ABSPATH . WPINC . '/wp-db.php' );
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
require_once( WP_CONTENT_DIR . '/db.php' );
if ( isset( $wpdb ) )
return;
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
}
/**
* Sets the database table prefix and the format specifiers for database table columns.
*