Upgrade/Install: Display "You are using a development version" message on WordPress Updates screen for Beta or RC versions.

This ensures that the message is displayed when the `WP_AUTO_UPDATE_CORE` constant is set to `beta` or `rc` and the user is on a development version.

Follow-up to [49245], [49254], [49292], [49638], [49708].

Props afragen, audrasjb, azaozz, SergeyBiryukov.
Reviewed by azaozz, SergeyBiryukov.
Merges [49709] and [49668] to the 5.6 branch.
Fixes #51822.
Built from https://develop.svn.wordpress.org/branches/5.6@49712


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-11-30 16:53:05 +00:00
parent 74600c1eed
commit 3ccb035e8d
2 changed files with 11 additions and 5 deletions

View File

@ -229,10 +229,14 @@ function dismissed_updates() {
function core_upgrade_preamble() { function core_upgrade_preamble() {
global $required_php_version, $required_mysql_version; global $required_php_version, $required_mysql_version;
$wp_version = get_bloginfo( 'version' );
$updates = get_core_updates(); $updates = get_core_updates();
if ( isset( $updates[0] ) && isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { // Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
echo '<h2 class="response">'; echo '<h2 class="response">';
_e( 'An updated version of WordPress is available.' ); _e( 'An updated version of WordPress is available.' );
echo '</h2>'; echo '</h2>';
@ -245,7 +249,7 @@ function core_upgrade_preamble() {
__( 'https://wordpress.org/support/article/updating-wordpress/' ) __( 'https://wordpress.org/support/article/updating-wordpress/' )
); );
echo '</p></div>'; echo '</p></div>';
} elseif ( isset( $updates[0] ) && 'development' === $updates[0]->response ) { } elseif ( $is_development_version ) {
echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>'; echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
} else { } else {
echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>'; echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>';
@ -258,6 +262,7 @@ function core_upgrade_preamble() {
echo '</li>'; echo '</li>';
} }
echo '</ul>'; echo '</ul>';
// Don't show the maintenance mode notice when we are only showing a single re-install option. // Don't show the maintenance mode notice when we are only showing a single re-install option.
if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) {
echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>';
@ -270,6 +275,7 @@ function core_upgrade_preamble() {
$normalized_version $normalized_version
) . '</p>'; ) . '</p>';
} }
dismissed_updates(); dismissed_updates();
} }

View File

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