From 1cf37b12ae8c8b79d6d8c6e767967c2babe6843f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 21 Jul 2022 21:39:08 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@53755 git-svn-id: http://core.svn.wordpress.org/trunk@53314 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/wp-db.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index aa8e485b85..e169a20b2f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53754'; +$wp_version = '6.1-alpha-53755'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index ac2d645e03..91803e7d62 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -8,7 +8,10 @@ * @package WordPress */ -_deprecated_file( basename( __FILE__ ), '6.1.0', WPINC . '/class-wpdb.php' ); +if ( function_exists( '_deprecated_file' ) ) { + // Note: WPINC may not be defined yet, so 'wp-includes' is used here. + _deprecated_file( basename( __FILE__ ), '6.1.0', 'wp-includes/class-wpdb.php' ); +} /** wpdb class */ -require_once ABSPATH . WPINC . '/class-wpdb.php'; +require_once ABSPATH . 'wp-includes/class-wpdb.php';