WordPress.org

Make WordPress Core

Ticket #14508: 14508.diff

File 14508.diff, 2.3 KB (added by ryan, 4 years ago)
  • wp-includes/functions.php

     
    30713071} 
    30723072 
    30733073/** 
    3074  * Load the correct database class file. 
    3075  * 
    3076  * This function is used to load the database class file either at runtime or by 
    3077  * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is 
    3078  * defined globally by the inline code in wp-db.php. 
    3079  * 
    3080  * @since 2.5.0 
    3081  * @global $wpdb WordPress Database Object 
    3082  */ 
    3083 function require_wp_db() { 
    3084         global $wpdb; 
    3085         if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) 
    3086                 require_once( WP_CONTENT_DIR . '/db.php' ); 
    3087         else 
    3088                 require_once( ABSPATH . WPINC . '/wp-db.php' ); 
    3089 } 
    3090  
    3091 /** 
    30923074 * Load custom DB error or display WordPress DB error. 
    30933075 * 
    30943076 * If a file exists in the wp-content directory named db-error.php, then it will 
  • wp-includes/wp-db.php

     
    15821582        } 
    15831583} 
    15841584 
    1585 if ( ! isset( $wpdb ) ) { 
    1586         /** 
    1587          * WordPress Database Object, if it isn't set already in wp-content/db.php 
    1588          * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database 
    1589          * @since 0.71 
    1590          */ 
    1591         $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); 
    1592 } 
    15931585?> 
  • 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. 
    71 require_wp_db(); 
     70require_once( ABSPATH . WPINC . '/wp-db.php' ); 
    7271 
     72// Load custom db.php, if it exists 
     73if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) 
     74        require_once( WP_CONTENT_DIR . '/db.php' ); 
     75 
     76if ( ! isset( $wpdb ) ) { 
     77        /** 
     78         * WordPress Database Object, if it isn't set already in wp-content/db.php 
     79         * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database 
     80         * @since 0.71 
     81         */ 
     82        $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); 
     83} 
     84 
    7385// Set the database table prefix and the format specifiers for database table columns. 
    7486wp_set_wpdb_vars(); 
    7587