WordPress.org

Make WordPress Core

Changeset 14348


Ignore:
Timestamp:
05/02/2010 10:57:44 PM (8 years ago)
Author:
nacin
Message:

Support network-wide plugin re-activation in upgrades and edits. props PeteMall, fixes #13216

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r14173 r14348  
    987987    var $plugin = '';
    988988    var $plugin_active = false;
     989    var $plugin_network_active = false;
    989990
    990991    function Plugin_Upgrader_Skin($args = array()) {
     
    998999        $this->plugin = $args['plugin'];
    9991000
    1000         $this->plugin_active = is_plugin_active($this->plugin);
     1001        $this->plugin_active = is_plugin_active( $this->plugin );
     1002        $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
    10011003
    10021004        parent::__construct($args);
     
    10071009        if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
    10081010            show_message(__('Reactivating the plugin…'));
    1009             echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
     1011            echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
    10101012        }
    10111013
  • trunk/wp-admin/plugin-editor.php

    r14299 r14348  
    5656        fclose($f);
    5757
     58        $network_wide = is_plugin_active_for_network( $file );
     59
    5860        // Deactivate so we can test it.
    5961        if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
     
    6365            update_option('recently_activated', array($file => time()) + (array)get_option('recently_activated'));
    6466
    65             wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto"));
     67            wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
    6668            exit;
    6769        }
     
    8486
    8587        if ( ! is_plugin_active($file) )
    86             activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
     88            activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
    8789
    8890        wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
  • trunk/wp-admin/update.php

    r14313 r14348  
    7070        if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
    7171            wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
    72             activate_plugin($plugin);
     72            activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ) );
    7373            wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
    7474            die();
Note: See TracChangeset for help on using the changeset viewer.