Make WordPress Core

Changeset 48804


Ignore:
Timestamp:
08/17/2020 01:02:38 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Site Health: Recognize define( 'WP_AUTO_UPDATE_CORE', 'minor' ) as an acceptable value.

Previously, it was only incidentally recognized as valid due to a loose comparison with true.

With the strict comparison added to WP_Site_Health_Auto_Updates::test_constants(), this was no longer the case.

Follow-up to [47841].

Props sterndata, mukesh27, avixansa, desrosj, SergeyBiryukov.
Merges [48792] to the 5.5 branch.
Fixes #50912.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-admin/includes/class-wp-site-health-auto-updates.php

    r48655 r48804  
    2828    public function run_tests() {
    2929        $tests = array(
    30             $this->test_constants( 'WP_AUTO_UPDATE_CORE', true ),
     30            $this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'minor' ) ),
    3131            $this->test_wp_version_check_attached(),
    3232            $this->test_filters_automatic_updater_disabled(),
     
    6161     *
    6262     * @since 5.2.0
    63      *
    64      * @param string $constant The name of the constant to check.
    65      * @param bool   $value    The value that the constant should be, if set.
     63     * @since 5.5.1 The `$value` parameter can accept an array.
     64     *
     65     * @param string $constant         The name of the constant to check.
     66     * @param bool|string|array $value The value that the constant should be, if set,
     67     *                                 or an array of acceptable values.
    6668     * @return array The test results.
    6769     */
    6870    public function test_constants( $constant, $value ) {
    69         if ( defined( $constant ) && constant( $constant ) !== $value ) {
     71        $acceptable_values = (array) $value;
     72
     73        if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) {
    7074            return array(
    7175                'description' => sprintf(
Note: See TracChangeset for help on using the changeset viewer.