Upgrade/Install: Allow WordPress sites to opt-in to beta & RC releases.

The `WP_AUTO_UPDATE_CORE` constant now supports `beta` and `rc` values.

This makes it possible for sites to opt-in to updating to RC (or beta) releases without having to install a plugin, or run on a development version.

Props dd32, knutsp.
Fixes #51319.
Built from https://develop.svn.wordpress.org/trunk@49245


git-svn-id: http://core.svn.wordpress.org/trunk@49007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-10-20 17:56:06 +00:00
parent 69fea120db
commit 6e71523ead
3 changed files with 12 additions and 3 deletions

View File

@ -283,14 +283,18 @@ class Core_Upgrader extends WP_Upgrader {
$upgrade_minor = true;
$upgrade_major = false;
// WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
// WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false.
if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
if ( false === WP_AUTO_UPDATE_CORE ) {
// Defaults to turned off, unless a filter allows it.
$upgrade_dev = false;
$upgrade_minor = false;
$upgrade_major = false;
} elseif ( true === WP_AUTO_UPDATE_CORE ) {
} elseif (
true === WP_AUTO_UPDATE_CORE
|| 'beta' === WP_AUTO_UPDATE_CORE
|| 'rc' === WP_AUTO_UPDATE_CORE
) {
// ALL updates for core.
$upgrade_dev = true;
$upgrade_minor = true;

View File

@ -136,6 +136,11 @@ 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 ) ) {
$query['channel'] = WP_AUTO_UPDATE_CORE;
}
$url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' );
$http_url = $url;
$ssl = wp_http_supports( array( 'ssl' ) );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49244';
$wp_version = '5.6-alpha-49245';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.