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. Fixes #50912. git-svn-id: https://develop.svn.wordpress.org/trunk@48792 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
285d176f08
commit
8c378606ab
@ -27,7 +27,7 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
*/
|
*/
|
||||||
public function run_tests() {
|
public function run_tests() {
|
||||||
$tests = array(
|
$tests = array(
|
||||||
$this->test_constants( 'WP_AUTO_UPDATE_CORE', true ),
|
$this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'minor' ) ),
|
||||||
$this->test_wp_version_check_attached(),
|
$this->test_wp_version_check_attached(),
|
||||||
$this->test_filters_automatic_updater_disabled(),
|
$this->test_filters_automatic_updater_disabled(),
|
||||||
$this->test_wp_automatic_updates_disabled(),
|
$this->test_wp_automatic_updates_disabled(),
|
||||||
@ -60,13 +60,17 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
* Test if auto-updates related constants are set correctly.
|
* Test if auto-updates related constants are set correctly.
|
||||||
*
|
*
|
||||||
* @since 5.2.0
|
* @since 5.2.0
|
||||||
|
* @since 5.5.1 The `$value` parameter can accept an array.
|
||||||
*
|
*
|
||||||
* @param string $constant The name of the constant to check.
|
* @param string $constant The name of the constant to check.
|
||||||
* @param bool $value The value that the constant should be, if set.
|
* @param bool|string|array $value The value that the constant should be, if set,
|
||||||
|
* or an array of acceptable values.
|
||||||
* @return array The test results.
|
* @return array The test results.
|
||||||
*/
|
*/
|
||||||
public function test_constants( $constant, $value ) {
|
public function test_constants( $constant, $value ) {
|
||||||
if ( defined( $constant ) && constant( $constant ) !== $value ) {
|
$acceptable_values = (array) $value;
|
||||||
|
|
||||||
|
if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) {
|
||||||
return array(
|
return array(
|
||||||
'description' => sprintf(
|
'description' => sprintf(
|
||||||
/* translators: %s: Name of the constant used. */
|
/* translators: %s: Name of the constant used. */
|
||||||
|
Loading…
Reference in New Issue
Block a user