WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/06/2010 08:39:50 AM (10 years ago)
Author:
dd32
Message:

First scrape at new UI for Bulk plugin upgrades. See #11232

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/update.php

    r13499 r13602  
    1717    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
    1818
    19     if ( 'upgrade-plugin' == $action ) {
     19    if ( 'update-selected' == $action ) {
     20        if ( ! current_user_can( 'update_plugins' ) )
     21            wp_die( __( 'You do not have sufficient permissions to update plugins for this blog.' ) );
     22
     23        check_admin_referer( 'bulk-update-plugins' );
     24
     25        if ( isset( $_GET['plugins'] ) )
     26            $plugins = explode( ',', stripslashes($_GET['plugins']) );
     27        elseif ( isset( $_POST['checked'] ) )
     28            $plugins = (array) $_POST['checked'];
     29        else
     30            $plugins = array();
     31
     32        $plugins = array_map('urldecode', $plugins);
     33
     34        $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
     35        $nonce = 'bulk-update-plugins';
     36
     37        require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
     38        wp_enqueue_script('jquery');
     39        iframe_header();
     40
     41        $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
     42        $upgrader->bulk_upgrade( $plugins );
     43
     44        iframe_footer();
     45        exit;
     46           
     47    } elseif ( 'upgrade-plugin' == $action ) {
    2048        if ( ! current_user_can('update_plugins') )
    2149            wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
Note: See TracChangeset for help on using the changeset viewer.