Make WordPress Core


Ignore:
Timestamp:
10/01/2024 05:57:49 PM (2 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r59147 r59155  
    13331333
    13341334        // Check WP_ENVIRONMENT_TYPE.
    1335         if ( defined( 'WP_ENVIRONMENT_TYPE' ) && WP_ENVIRONMENT_TYPE ) {
    1336             $wp_environment_type = WP_ENVIRONMENT_TYPE;
     1335        if ( defined( 'WP_ENVIRONMENT_TYPE' ) ) {
     1336            $wp_environment_type       = WP_ENVIRONMENT_TYPE ? WP_ENVIRONMENT_TYPE : __( 'Empty value' );
     1337            $wp_environment_type_debug = WP_ENVIRONMENT_TYPE;
    13371338        } else {
    1338             $wp_environment_type = __( 'Undefined' );
     1339            $wp_environment_type       = __( 'Undefined' );
     1340            $wp_environment_type_debug = 'undefined';
    13391341        }
    13401342
    13411343        // Check DB_COLLATE.
    1342         if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) {
    1343             $wp_db_collate = DB_COLLATE;
    1344         } elseif ( defined( 'DB_COLLATE' ) && empty( DB_COLLATE ) ) {
    1345             $wp_db_collate = __( 'Defined, but empty' );
     1344        if ( defined( 'DB_COLLATE' ) ) {
     1345            $db_collate       = DB_COLLATE ? DB_COLLATE : __( 'Empty value' );
     1346            $db_collate_debug = DB_COLLATE;
    13461347        } else {
    1347             $wp_db_collate = __( 'Undefined' );
     1348            $db_collate       = __( 'Undefined' );
     1349            $db_collate_debug = 'undefined';
    13481350        }
    13491351
     
    14231425                'label' => 'WP_ENVIRONMENT_TYPE',
    14241426                'value' => $wp_environment_type,
    1425                 'debug' => $wp_environment_type,
     1427                'debug' => $wp_environment_type_debug,
    14261428            ),
    14271429            'WP_DEVELOPMENT_MODE' => array(
     
    14371439            'DB_COLLATE'          => array(
    14381440                'label' => 'DB_COLLATE',
    1439                 'value' => $wp_db_collate,
    1440                 'debug' => $wp_db_collate,
     1441                'value' => $db_collate,
     1442                'debug' => $db_collate_debug,
    14411443            ),
    14421444        );
Note: See TracChangeset for help on using the changeset viewer.