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:
parent
e9cfb43133
commit
61f8b8f569
|
@ -1,5 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
define('WP_INSTALLING', true);
|
define('WP_INSTALLING', true);
|
||||||
|
//These two defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
|
||||||
|
define('ABSPATH', dirname(dirname(__FILE__)).'/');
|
||||||
|
define('WPINC', 'wp-includes');
|
||||||
|
|
||||||
require_once('../wp-includes/compat.php');
|
require_once('../wp-includes/compat.php');
|
||||||
require_once('../wp-includes/functions.php');
|
require_once('../wp-includes/functions.php');
|
||||||
|
@ -160,7 +163,7 @@ switch($step) {
|
||||||
define('DB_HOST', $dbhost);
|
define('DB_HOST', $dbhost);
|
||||||
|
|
||||||
// We'll fail here if the values are no good.
|
// We'll fail here if the values are no good.
|
||||||
require_once('../wp-includes/wp-db.php');
|
require_wp_db();
|
||||||
$handle = fopen('../wp-config.php', 'w');
|
$handle = fopen('../wp-config.php', 'w');
|
||||||
|
|
||||||
foreach ($configFile as $line_num => $line) {
|
foreach ($configFile as $line_num => $line) {
|
||||||
|
|
|
@ -1415,4 +1415,21 @@ function wp_ob_end_flush_all()
|
||||||
while ( @ob_end_flush() );
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -121,11 +121,7 @@ if ( !defined('PLUGINDIR') )
|
||||||
require (ABSPATH . WPINC . '/compat.php');
|
require (ABSPATH . WPINC . '/compat.php');
|
||||||
require (ABSPATH . WPINC . '/functions.php');
|
require (ABSPATH . WPINC . '/functions.php');
|
||||||
|
|
||||||
if ( file_exists(ABSPATH . 'wp-content/db.php') )
|
require_wp_db();
|
||||||
require_once (ABSPATH . 'wp-content/db.php');
|
|
||||||
else
|
|
||||||
require_once (ABSPATH . WPINC . '/wp-db.php');
|
|
||||||
|
|
||||||
// $table_prefix is deprecated as of 2.1
|
// $table_prefix is deprecated as of 2.1
|
||||||
$wpdb->prefix = $table_prefix;
|
$wpdb->prefix = $table_prefix;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue