mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user