mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
First scrape at new UI for Bulk plugin upgrades. See #11232
git-svn-id: https://develop.svn.wordpress.org/trunk@13602 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+29
-1
@@ -16,7 +16,35 @@ if ( isset($_GET['action']) ) {
|
||||
$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
|
||||
if ( 'upgrade-plugin' == $action ) {
|
||||
if ( 'update-selected' == $action ) {
|
||||
if ( ! current_user_can( 'update_plugins' ) )
|
||||
wp_die( __( 'You do not have sufficient permissions to update plugins for this blog.' ) );
|
||||
|
||||
check_admin_referer( 'bulk-update-plugins' );
|
||||
|
||||
if ( isset( $_GET['plugins'] ) )
|
||||
$plugins = explode( ',', stripslashes($_GET['plugins']) );
|
||||
elseif ( isset( $_POST['checked'] ) )
|
||||
$plugins = (array) $_POST['checked'];
|
||||
else
|
||||
$plugins = array();
|
||||
|
||||
$plugins = array_map('urldecode', $plugins);
|
||||
|
||||
$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
|
||||
$nonce = 'bulk-update-plugins';
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
||||
wp_enqueue_script('jquery');
|
||||
iframe_header();
|
||||
|
||||
$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
|
||||
$upgrader->bulk_upgrade( $plugins );
|
||||
|
||||
iframe_footer();
|
||||
exit;
|
||||
|
||||
} elseif ( 'upgrade-plugin' == $action ) {
|
||||
if ( ! current_user_can('update_plugins') )
|
||||
wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user