WordPress.org

Make WordPress Core

Ticket #14508: 14508.2.diff

File 14508.2.diff, 3.1 KB (added by nacin, 8 years ago)
  • wp-includes/functions.php

     
    31013101}
    31023102
    31033103/**
    3104  * Load the correct database class file.
    3105  *
    3106  * This function is used to load the database class file either at runtime or by
    3107  * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
    3108  * defined globally by the inline code in wp-db.php.
    3109  *
    3110  * @since 2.5.0
    3111  * @global $wpdb WordPress Database Object
    3112  */
    3113 function require_wp_db() {
    3114         global $wpdb;
    3115         if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
    3116                 require_once( WP_CONTENT_DIR . '/db.php' );
    3117         else
    3118                 require_once( ABSPATH . WPINC . '/wp-db.php' );
    3119 }
    3120 
    3121 /**
    31223104 * Load custom DB error or display WordPress DB error.
    31233105 *
    31243106 * If a file exists in the wp-content directory named db-error.php, then it will
  • wp-includes/load.php

     
    308308}
    309309
    310310/**
     311 * Load the correct database class file.
     312 *
     313 * This function is used to load the database class file either at runtime or by
     314 * wp-admin/setup-config.php. We must globalize $wpdb to ensure that it is
     315 * defined globally by the inline code in wp-db.php.
     316 *
     317 * @since 2.5.0
     318 * @global $wpdb WordPress Database Object
     319 */
     320function require_wp_db() {
     321        global $wpdb;
     322
     323        require_once( ABSPATH . WPINC . '/wp-db.php' );
     324        if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
     325                require_once( WP_CONTENT_DIR . '/db.php' );
     326
     327        if ( ! isset( $wpdb ) ) {
     328                /**
     329                 * WordPress Database Object, if it isn't set already in wp-content/db.php
     330                 * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
     331                 * @since 0.71
     332                 */
     333                $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
     334        }
     335}
     336
     337/**
    311338 * Sets the database table prefix and the format specifiers for database table columns.
    312339 *
    313340 * Columns not listed here default to %s.
  • wp-includes/wp-db.php

     
    15541554        }
    15551555}
    15561556
    1557 if ( ! isset( $wpdb ) ) {
    1558         /**
    1559          * WordPress Database Object, if it isn't set already in wp-content/db.php
    1560          * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
    1561          * @since 0.71
    1562          */
    1563         $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
    1564 }
    15651557?>
  • wp-settings.php

     
    6767require( ABSPATH . WPINC . '/functions.php' );
    6868require( ABSPATH . WPINC . '/classes.php' );
    6969
    70 // Include the wpdb class, or a db.php database drop-in if present.
     70// Include the wpdb class and, if present, a db.php database drop-in.
    7171require_wp_db();
    7272
    7373// Set the database table prefix and the format specifiers for database table columns.