Move database class loading to a shared function to ensure all of WordPress is wp-content/wp-db.php aware. Fixes #5128 props ComputerGuru.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi
2007-10-06 08:18:33 +00:00
parent e9cfb43133
commit 61f8b8f569
3 changed files with 22 additions and 6 deletions

View File

@@ -1415,4 +1415,21 @@ function wp_ob_end_flush_all()
while ( @ob_end_flush() );
}
/*
* require_wp_db() - require_once 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 globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php
*
* @global $wpdb
*/
function require_wp_db()
{
global $wpdb;
if ( file_exists(ABSPATH . 'wp-content/db.php') )
require_once (ABSPATH . 'wp-content/db.php');
else
require_once (ABSPATH . WPINC . '/wp-db.php');
}
?>