Make WordPress Core

Ticket #48692: 48692-php-default-timezone-site-health.patch

File 48692-php-default-timezone-site-health.patch, 2.0 KB (added by Rarst, 4 years ago)
  • src/wp-admin/includes/class-wp-site-health.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    18281828                return $result;
    18291829        }
    18301830
     1831        /**
     1832         * Test if the default PHP timezone is set to UTC.
     1833         *
     1834         * @return array The test results.
     1835         * @since 5.3.1
     1836         */
     1837        public function get_test_php_default_timezone() {
     1838
     1839                if ( 'UTC' === date_default_timezone_get() ) {
     1840
     1841                        return array(
     1842                                'label'       => __( 'Default PHP timezone setting is valid' ),
     1843                                'status'      => 'good',
     1844                                'badge'       => array(
     1845                                        'label' => __( 'Performance' ),
     1846                                        'color' => 'blue',
     1847                                ),
     1848                                'description' => sprintf(
     1849                                        '<p>%s</p>',
     1850                                        __( 'Default PHP timezone setting was configured by WordPress during load. This is necessary for correct calculations of dates and times.' )
     1851                                ),
     1852                                'test'        => 'php_default_timezone',
     1853                        );
     1854                }
     1855
     1856                return array(
     1857                        'label'       => __( 'Default PHP timezone setting is invalid' ),
     1858                        'status'      => 'critical',
     1859                        'badge'       => array(
     1860                                'label' => __( 'Performance' ),
     1861                                'color' => 'red',
     1862                        ),
     1863                        'description' => sprintf(
     1864                                '<p>%s</p>',
     1865                                __( 'Default PHP timezone setting was changed after WordPress load by a <code>date_default_timezone_set()</code> function call. This interferes with correct calculations of dates and times.' )
     1866                        ),
     1867                        'test'        => 'php_default_timezone',
     1868                );
     1869        }
     1870
    18311871        /**
    18321872         * Return a set of tests that belong to the site status page.
    18331873         *
     
    18901930                                        'label' => __( 'Debugging enabled' ),
    18911931                                        'test'  => 'is_in_debug_mode',
    18921932                                ),
     1933                                'php_default_timezone'     => array(
     1934                                        'label' => __( 'PHP Default Timezone' ),
     1935                                        'test'  => 'php_default_timezone',
     1936                                ),
    18931937                        ),
    18941938                        'async'  => array(
    18951939                                'dotorg_communication' => array(