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: https://develop.svn.wordpress.org/trunk@6198 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood
2007-10-06 08:18:33 +00:00
parent 3c2cc79a46
commit 0919b3ca32
3 changed files with 22 additions and 6 deletions
+17
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');
}
?>