Site Health: Adjust display of the `DB_COLLATE` and `WP_ENVIRONMENT_TYPE` constants.

Includes: 
* Simplifying the logic and bringing some consistency to how the values are checked and displayed.
* Correcting the debug value for `DB_COLLATE`. This should be the actual contents of the constant, and empty if it is indeed empty, as the debug data that's copied and shared should represent the raw value, and does not need to be in a user-readable format.

Follow-up to [45782], [52021], [54239], [59147].

Props Clorith, SergeyBiryukov.
See #58265.
Built from https://develop.svn.wordpress.org/trunk@59155


git-svn-id: http://core.svn.wordpress.org/trunk@58550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-10-01 17:59:17 +00:00
parent 18f992af83
commit 46b25e1302
2 changed files with 14 additions and 12 deletions

View File

@ -1332,19 +1332,21 @@ class WP_Debug_Data {
}
// Check WP_ENVIRONMENT_TYPE.
if ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE ) {
$wp_environment_type = WP_ENVIRONMENT_TYPE;
if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) {
$wp_environment_type = WP_ENVIRONMENT_TYPE ? WP_ENVIRONMENT_TYPE : __( 'Empty value' );
$wp_environment_type_debug = WP_ENVIRONMENT_TYPE;
} else {
$wp_environment_type = __( 'Undefined' );
$wp_environment_type = __( 'Undefined' );
$wp_environment_type_debug = 'undefined';
}
// Check DB_COLLATE.
if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) {
$wp_db_collate = DB_COLLATE;
} elseif ( defined( 'DB_COLLATE' ) && empty( DB_COLLATE ) ) {
$wp_db_collate = __( 'Defined, but empty' );
if ( defined( 'DB_COLLATE' ) ) {
$db_collate = DB_COLLATE ? DB_COLLATE : __( 'Empty value' );
$db_collate_debug = DB_COLLATE;
} else {
$wp_db_collate = __( 'Undefined' );
$db_collate = __( 'Undefined' );
$db_collate_debug = 'undefined';
}
$fields = array(
@ -1422,7 +1424,7 @@ class WP_Debug_Data {
'WP_ENVIRONMENT_TYPE' => array(
'label' => 'WP_ENVIRONMENT_TYPE',
'value' => $wp_environment_type,
'debug' => $wp_environment_type,
'debug' => $wp_environment_type_debug,
),
'WP_DEVELOPMENT_MODE' => array(
'label' => 'WP_DEVELOPMENT_MODE',
@ -1436,8 +1438,8 @@ class WP_Debug_Data {
),
'DB_COLLATE' => array(
'label' => 'DB_COLLATE',
'value' => $wp_db_collate,
'debug' => $wp_db_collate,
'value' => $db_collate,
'debug' => $db_collate_debug,
),
);

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-beta1-59154';
$wp_version = '6.7-beta1-59155';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.