From f0f0be74f2f2590176e0f4856b74f91e712ee6c1 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 27 Jun 2023 08:02:46 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/class-wp-debug-data.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index 692fd0b559..0bcc06954a 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/wp-admin/includes/class-wp-debug-data.php @@ -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.