From f6191c07df4a386109dddd6dd10a359a1d9a9456 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 30 Jan 2021 10:34:02 +0000 Subject: [PATCH] Upgrade/Install: Allow WordPress sites to opt-in to development releases. The `WP_AUTO_UPDATE_CORE` constant now supports `development` and `branch-development` values. This makes it possible for sites to opt-in to updating to nightly builds without having to install a plugin. Follow-up to [49245], [49292]. Props xkon, knutsp, afragen, audrasjb, dd32. Fixes #51978. Built from https://develop.svn.wordpress.org/trunk@50082 git-svn-id: http://core.svn.wordpress.org/trunk@49782 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-core-upgrader.php | 5 ++--- wp-admin/includes/class-wp-site-health-auto-updates.php | 2 +- wp-admin/update-core.php | 5 ++--- wp-includes/update.php | 6 ++++-- wp-includes/version.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index b57a13fd7b..7acbaaed49 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -283,7 +283,7 @@ class Core_Upgrader extends WP_Upgrader { $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; - // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. + // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it. @@ -291,8 +291,7 @@ class Core_Upgrader extends WP_Upgrader { $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE - || 'beta' === WP_AUTO_UPDATE_CORE - || 'rc' === WP_AUTO_UPDATE_CORE + || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { // ALL updates for core. $upgrade_dev = true; diff --git a/wp-admin/includes/class-wp-site-health-auto-updates.php b/wp-admin/includes/class-wp-site-health-auto-updates.php index 11d2c2fb48..1ddaa05feb 100644 --- a/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -27,7 +27,7 @@ class WP_Site_Health_Auto_Updates { */ public function run_tests() { $tests = array( - $this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'minor' ) ), + $this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ), $this->test_wp_version_check_attached(), $this->test_filters_automatic_updater_disabled(), $this->test_wp_automatic_updates_disabled(), diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 2979d69996..35ae406799 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -306,7 +306,7 @@ function core_auto_updates_settings() { $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; $can_set_update_option = true; - // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. + // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'development', 'branch-development', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { // Defaults to turned off, unless a filter allows it. @@ -314,8 +314,7 @@ function core_auto_updates_settings() { $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE - || 'beta' === WP_AUTO_UPDATE_CORE - || 'rc' === WP_AUTO_UPDATE_CORE + || in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) ) { // ALL updates for core. $upgrade_dev = true; diff --git a/wp-includes/update.php b/wp-includes/update.php index c632b8405a..d4b538e29d 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -136,8 +136,10 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) { $post_body = array_merge( $post_body, $extra_stats ); } - // Allow for WP_AUTO_UPDATE_CORE to specify beta/RC releases. - if ( defined( 'WP_AUTO_UPDATE_CORE' ) && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc' ), true ) ) { + // Allow for WP_AUTO_UPDATE_CORE to specify beta/RC/development releases. + if ( defined( 'WP_AUTO_UPDATE_CORE' ) + && in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true ) + ) { $query['channel'] = WP_AUTO_UPDATE_CORE; } diff --git a/wp-includes/version.php b/wp-includes/version.php index a7991c3f6f..cde437c34a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-50081'; +$wp_version = '5.7-alpha-50082'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.