WordPress.org

Make WordPress Core

Changeset 6198


Ignore:
Timestamp:
10/06/2007 08:18:33 AM (14 years ago)
Author:
westi
Message:

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/setup-config.php

    r6137 r6198  
    11<?php
    22define('WP_INSTALLING', true);
     3//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
     4define('ABSPATH', dirname(dirname(__FILE__)).'/');
     5define('WPINC', 'wp-includes');
    36
    47require_once('../wp-includes/compat.php');
     
    161164
    162165    // We'll fail here if the values are no good.
    163     require_once('../wp-includes/wp-db.php');
     166    require_wp_db();
    164167    $handle = fopen('../wp-config.php', 'w');
    165168
  • trunk/wp-includes/functions.php

    r6180 r6198  
    14161416}
    14171417
     1418/*
     1419 * require_wp_db() - require_once the correct database class file.
     1420 *
     1421 * This function is used to load the database class file either at runtime or by wp-admin/setup-config.php
     1422 * We must globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php
     1423 *
     1424 * @global $wpdb
     1425 */
     1426function require_wp_db()
     1427{
     1428    global $wpdb;
     1429    if ( file_exists(ABSPATH . 'wp-content/db.php') )
     1430        require_once (ABSPATH . 'wp-content/db.php');
     1431    else
     1432        require_once (ABSPATH . WPINC . '/wp-db.php');
     1433}
     1434
    14181435?>
  • trunk/wp-settings.php

    r6181 r6198  
    122122require (ABSPATH . WPINC . '/functions.php');
    123123
    124 if ( file_exists(ABSPATH . 'wp-content/db.php') )
    125     require_once (ABSPATH . 'wp-content/db.php');
    126 else
    127     require_once (ABSPATH . WPINC . '/wp-db.php');
    128 
     124require_wp_db();
    129125// $table_prefix is deprecated as of 2.1
    130126$wpdb->prefix = $table_prefix;
Note: See TracChangeset for help on using the changeset viewer.