Bootstrap/Load: Don't assume WP_CONTENT_DIR is defined.

When the `mysql` extention isn't loaded and a custom db dropin is not in place, we give folks a nice error. However, we can't assume that the `WP_CONTENT_DIR` constant is set yet since this runs before we define default constants.

This fixes a PHP 8 error.

Props jorbin.
Merges [49161] to trunk.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49163 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-10-15 21:14:35 +00:00
parent e5b9d995a8
commit 93a325ccf8

View File

@ -153,7 +153,11 @@ function wp_check_php_mysql_versions() {
exit( 1 ); exit( 1 );
} }
if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' )
// This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.
&& ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' )
|| ! file_exists( ABSPATH . 'wp-content/db.php' ) )
) {
require_once ABSPATH . WPINC . '/functions.php'; require_once ABSPATH . WPINC . '/functions.php';
wp_load_translations_early(); wp_load_translations_early();
$args = array( $args = array(