Make WordPress Core

Changeset 56056


Ignore:
Timestamp:
06/27/2023 08:02:46 AM (18 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

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

    r55404 r56056  
    839839            );
    840840        }
     841
     842        // Server time.
     843        $date = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
     844        $info['wp-server']['fields']['current'] = array(
     845            'label' => __( 'Current time' ),
     846            'value' => $date->format( DateTime::ATOM ),
     847        );
     848        $info['wp-server']['fields']['utc-time'] = array(
     849            'label' => __( 'Current UTC time' ),
     850            'value' => $date->format( DateTime::RFC850 ),
     851        );
     852        $info['wp-server']['fields']['server-time'] = array(
     853            'label' => __( 'Current Server time' ),
     854            'value' => wp_date( 'c', $_SERVER['REQUEST_TIME'] ),
     855        );
    841856
    842857        // Populate the database debug fields.
Note: See TracChangeset for help on using the changeset viewer.