Give feedback when Upgrade Plugins is clicked but no plugins are selected. see #10973

git-svn-id: https://develop.svn.wordpress.org/trunk@12436 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-12-17 20:18:12 +00:00
parent d117c4918b
commit c3e7918ed8

View File

@ -95,12 +95,20 @@ function dismissed_updates() {
* @return null * @return null
*/ */
function core_upgrade_preamble() { function core_upgrade_preamble() {
global $upgrade_error;
$updates = get_core_updates(); $updates = get_core_updates();
?> ?>
<div class="wrap"> <div class="wrap">
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php _e('Upgrade WordPress'); ?></h2> <h2><?php _e('Upgrade WordPress'); ?></h2>
<?php <?php
if ( $upgrade_error ) {
echo '<div class="error"><p>';
_e('Please select one or more plugins to upgrade.');
echo '</p></div>';
}
if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
echo '<h3>'; echo '<h3>';
_e('You have the latest version of WordPress. You do not need to upgrade'); _e('You have the latest version of WordPress. You do not need to upgrade');
@ -331,8 +339,11 @@ function do_plugin_upgrade() {
if ( isset($_GET['plugins']) ) { if ( isset($_GET['plugins']) ) {
$plugins = explode(',', $_GET['plugins']); $plugins = explode(',', $_GET['plugins']);
} else { } elseif ( isset($_POST['checked']) ) {
$plugins = (array) $_POST['checked']; $plugins = (array) $_POST['checked'];
} else {
// Nothing to do.
return;
} }
$url = 'update-core.php?action=do-plugin-upgrade&amp;plugins=' . urlencode(join(',', $plugins)); $url = 'update-core.php?action=do-plugin-upgrade&amp;plugins=' . urlencode(join(',', $plugins));
$title = __('Upgrade Plugins'); $title = __('Upgrade Plugins');
@ -343,6 +354,12 @@ function do_plugin_upgrade() {
$action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
$upgrade_error = false;
if ( 'do-plugin-upgrade' == $action && !isset($_GET['plugins']) && !isset($_POST['checked']) ) {
$upgrade_error = true;
$action = 'upgrade-core';
}
$title = __('Upgrade WordPress'); $title = __('Upgrade WordPress');
$parent_file = 'tools.php'; $parent_file = 'tools.php';