Make WordPress Core

Ticket #47058: 47058.2.diff

File 47058.2.diff, 1.8 KB (added by dkotter, 5 years ago)
  • src/wp-admin/includes/class-wp-site-health.php

     
    106106                if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) {
    107107                        $tests = WP_Site_Health::get_tests();
    108108
    109                         // Don't run https test on localhost.
    110                         if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) {
     109                        // Don't run https test on development environments.
     110                        if ( $this->is_development_environment() ) {
    111111                                unset( $tests['direct']['https_status'] );
    112112                        }
    113113
     
    14641464
    14651465                                $result['status'] = 'critical';
    14661466
     1467                                // On development environments, set the status to recommended
     1468                                if ( $this->is_development_environment() ) {
     1469                                        $result['status'] = 'recommended';
     1470                                }
     1471
    14671472                                $result['description'] .= sprintf(
    14681473                                        '<p>%s</p>',
    14691474                                        sprintf(
     
    25192524                        'critical'    => 0,
    25202525                );
    25212526
    2522                 // Don't run https test on localhost.
    2523                 if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) {
     2527                // Don't run https test on development environments.
     2528                if ( $this->is_development_environment() ) {
    25242529                        unset( $tests['direct']['https_status'] );
    25252530                }
    25262531
     
    25952600
    25962601                set_transient( 'health-check-site-status-result', wp_json_encode( $site_status ) );
    25972602        }
     2603
     2604        /**
     2605         * Check if we are in a development environment.
     2606         *
     2607         * Checks if the wp_get_environment_type function returns
     2608         * development or local.
     2609         *
     2610         * @since 5.6.0
     2611         *
     2612         * @return bool True if it is a development environment, false if not.
     2613         */
     2614        public function is_development_environment() {
     2615                return in_array( wp_get_environment_type(), array( 'development', 'local' ), true );
     2616        }
     2617
    25982618}