Upgrade/Install: Only show errors if there is nothing to update.

Previously, when the `do-plugin-upgrade` or `do-theme-upgrade` actions were accessed directly on `update-core.php`, an error message stating "Select one or 
more (plugins|themes) to update" would be shown even if there was nothing to update.

This ensures that the error message only appears when there is something to update.

Props Presskopp, sabernhardt, pbiron, afragen, zunaid321, shuvoaftab, ugyensupport, costdev.
Fixes #57999.



Built from https://develop.svn.wordpress.org/trunk@56107


git-svn-id: http://core.svn.wordpress.org/trunk@55619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-06-29 07:21:22 +00:00
parent b89f4fe4aa
commit c9421f4401
2 changed files with 13 additions and 5 deletions

View File

@ -1037,13 +1037,21 @@ if ( 'upgrade-core' === $action ) {
<?php
if ( $upgrade_error ) {
echo '<div class="error"><p>';
if ( 'themes' === $upgrade_error ) {
_e( 'Please select one or more themes to update.' );
$theme_updates = get_theme_updates();
if ( ! empty( $theme_updates ) ) {
echo '<div class="error"><p>';
_e( 'Please select one or more themes to update.' );
echo '</p></div>';
}
} else {
_e( 'Please select one or more plugins to update.' );
$plugin_updates = get_plugin_updates();
if ( ! empty( $plugin_updates ) ) {
echo '<div class="error"><p>';
_e( 'Please select one or more plugins to update.' );
echo '</p></div>';
}
}
echo '</p></div>';
}
$last_update_check = false;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-beta2-56106';
$wp_version = '6.3-beta2-56107';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.