Make WordPress Core


Ignore:
Timestamp:
07/21/2022 09:37:03 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Check if the _deprecated_file() function exists in wp-db.php.

This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.

Additionally, replace WPINC with wp-includes, as the constant may not be defined yet in that context.

Follow-up to [53749], [53750].

See #56268, #55647.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r53749 r53755  
    99 */
    1010
    11 _deprecated_file( basename( __FILE__ ), '6.1.0', WPINC . '/class-wpdb.php' );
     11if ( function_exists( '_deprecated_file' ) ) {
     12    // Note: WPINC may not be defined yet, so 'wp-includes' is used here.
     13    _deprecated_file( basename( __FILE__ ), '6.1.0', 'wp-includes/class-wpdb.php' );
     14}
    1215
    1316/** wpdb class */
    14 require_once ABSPATH . WPINC . '/class-wpdb.php';
     17require_once ABSPATH . 'wp-includes/class-wpdb.php';
Note: See TracChangeset for help on using the changeset viewer.