WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/09/2009 06:53:21 PM (10 years ago)
Author:
ryan
Message:

Put site into maintenance mode during bulk plugin upgrade. Skip plugin deactivate/activate. Add compatibility info. see #10973

File:
1 edited

Legend:

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

    r12107 r12157  
    433433                ));
    434434
    435         //Cleanup our hooks, incase something else does a upgrade on this connection.
     435        // Cleanup our hooks, incase something else does a upgrade on this connection.
    436436        remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
    437437        remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
     
    452452        $current = get_transient( 'update_plugins' );
    453453
    454         add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
    455454        add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
    456455
    457456        $this->skin->header();
     457
     458        // Connect to the Filesystem first.
     459        $res = $this->fs_connect( array(WP_CONTENT_DIR, WP_PLUGIN_DIR) );
     460        if ( ! $res ) {
     461            $this->skin->footer();
     462            return false;
     463        }
     464
     465        $this->maintenance_mode(true);
     466
    458467        $all = count($plugins);
    459468        $i = 1;
     
    493502                break;
    494503        }
     504        $this->maintenance_mode(false);
    495505        $this->skin->footer();
    496506
    497         //Cleanup our hooks, incase something else does a upgrade on this connection.
    498         remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
     507        // Cleanup our hooks, incase something else does a upgrade on this connection.
    499508        remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
    500509
     
    900909
    901910    function after() {
     911        if ( $this->upgrader->bulk )
     912            return;
     913
    902914        $this->plugin = $this->upgrader->plugin_info();
    903915        if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
     
    905917            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>';
    906918        }
     919
    907920        $update_actions =  array(
    908921            'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
Note: See TracChangeset for help on using the changeset viewer.