Make WordPress Core


Ignore:
Timestamp:
09/14/2022 10:17:53 PM (3 years ago)
Author:
azaozz
Message:

Site health:

  • Add a check to wp_check_php_version() whether the current PHP version is lower than the next (desired) minimum version.
  • Set the next desired minimum PHP version to 7.2.
  • Use that check to update the warnings in the wp_dashboard_php_nag() widget, and on the Site Health screen.

Props Clorith, SergeyBiryukov, ironprogrammer, azaozz.
See #56199.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r54133 r54169  
    742742                sprintf(
    743743                    /* translators: %s: The minimum recommended PHP version. */
    744                     __( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site’s performance. The minimum recommended version of PHP is %s.' ),
     744                    __( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site’s performance. The minimum recommended version of PHP is %s.' ),
    745745                    $response ? $response['recommended_version'] : ''
    746746                )
     
    765765            $result['label'] = sprintf(
    766766                /* translators: %s: The server PHP version. */
    767                 __( 'Your site is running an older version of PHP (%s)' ),
     767                __( 'Your site is running on an older version of PHP (%s)' ),
    768768                PHP_VERSION
    769769            );
    770770            $result['status'] = 'recommended';
     771
     772            return $result;
     773        }
     774
     775        // The PHP version is still receiving security fixes, but is lower than
     776        // the expected minimum version that will be required by WordPress in the near future.
     777        if ( $response['is_secure'] && $response['is_lower_than_future_minimum'] ) {
     778            // The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates.
     779
     780            $result['label'] = sprintf(
     781                /* translators: %s: The server PHP version. */
     782                __( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress.' ),
     783                PHP_VERSION
     784            );
     785
     786            $result['status']         = 'critical';
     787            $result['badge']['label'] = __( 'Requirements' );
    771788
    772789            return $result;
     
    777794            $result['label'] = sprintf(
    778795                /* translators: %s: The server PHP version. */
    779                 __( 'Your site is running an older version of PHP (%s), which should be updated' ),
     796                __( 'Your site is running on an older version of PHP (%s), which should be updated' ),
    780797                PHP_VERSION
    781798            );
     
    785802        }
    786803
    787         // Anything no longer secure must be updated.
    788         $result['label'] = sprintf(
    789             /* translators: %s: The server PHP version. */
    790             __( 'Your site is running an outdated version of PHP (%s), which requires an update' ),
    791             PHP_VERSION
    792         );
    793         $result['status']         = 'critical';
     804        // No more security updates for the PHP version, and lower than the expected minimum version required by WordPress.
     805        if ( $response['is_lower_than_future_minimum'] ) {
     806            $message = sprintf(
     807                /* translators: %s: The server PHP version. */
     808                __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress.' ),
     809                PHP_VERSION
     810            );
     811        } else {
     812            // No more security updates for the PHP version, must be updated.
     813            $message = sprintf(
     814                /* translators: %s: The server PHP version. */
     815                __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
     816                PHP_VERSION
     817            );
     818        }
     819
     820        $result['label']  = $message;
     821        $result['status'] = 'critical';
     822
    794823        $result['badge']['label'] = __( 'Security' );
    795824
Note: See TracChangeset for help on using the changeset viewer.