Site Health: Add server time debug data.

This changeset adds "Current time, "Current UTC time" and "Current Server time" under the "Server" section of Site Health debug infos. This provides the 
current time, the server time, and allow for comparison if there's some time-related issues.

Props sebastienserre, Clorith, audrasjb, kebbet, robinwpdeveloper, hrrarya, mukesh27, hareesh-pillai, costdev.
Fixes #56378.



Built from https://develop.svn.wordpress.org/trunk@56056


git-svn-id: http://core.svn.wordpress.org/trunk@55568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-06-27 08:04:20 +00:00
parent 2e2aea02c2
commit 37ebdb8fa1
2 changed files with 16 additions and 1 deletions

View File

@ -839,6 +839,21 @@ class WP_Debug_Data {
);
}
// Server time.
$date = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
$info['wp-server']['fields']['current'] = array(
'label' => __( 'Current time' ),
'value' => $date->format( DateTime::ATOM ),
);
$info['wp-server']['fields']['utc-time'] = array(
'label' => __( 'Current UTC time' ),
'value' => $date->format( DateTime::RFC850 ),
);
$info['wp-server']['fields']['server-time'] = array(
'label' => __( 'Current Server time' ),
'value' => wp_date( 'c', $_SERVER['REQUEST_TIME'] ),
);
// Populate the database debug fields.
if ( is_resource( $wpdb->dbh ) ) {
// Old mysql extension.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-56055';
$wp_version = '6.3-alpha-56056';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.