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.




git-svn-id: https://develop.svn.wordpress.org/trunk@56056 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2023-06-27 08:02:46 +00:00
parent 7e9385e485
commit f0f0be74f2

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.