WordPress.org

Make WordPress Core

Changeset 12157


Ignore:
Timestamp:
11/09/09 18:53:21 (4 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
3 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>', 
  • trunk/wp-admin/update-core.php

    r12107 r12157  
    134134 
    135135function list_plugin_updates() { 
     136    global $wp_version; 
     137 
     138    $cur_wp_version = preg_replace('/-.*$/', '', $wp_version); 
     139 
     140    require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); 
    136141    $plugins = get_plugin_updates(); 
    137142    if ( empty($plugins) ) 
     
    161166<?php 
    162167    foreach ( (array) $plugins as $plugin_file => $plugin_data) { 
     168        $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug )); 
     169        if ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) { 
     170            $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version]; 
     171            $compat = '  ' . sprintf(__('Compatibility: %1$d%% (%2$d "works" votes out of %3$d total)'), $compat[0], $compat[2], $compat[1]); 
     172        } else { 
     173            $compat = ''; 
     174        } 
    163175        echo " 
    164176    <tr class='active'> 
    165177        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> 
    166         <td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You are running version %1$s. Upgrade to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . "</td> 
     178        <td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You are running version %1$s. Upgrade to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . "</td> 
    167179    </tr>"; 
    168180    } 
     
    301313    $title = __('Upgrade Plugins'); 
    302314    $nonce = 'upgrade-core'; 
    303     add_filter('update_plugin_complete_actions', 'no_update_actions'); 
    304  
    305315    $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) ); 
    306316    $upgrader->bulk_upgrade($plugins); 
  • trunk/wp-includes/update.php

    r11829 r12157  
    315315add_action( 'load-plugins.php', 'wp_update_plugins' ); 
    316316add_action( 'load-update.php', 'wp_update_plugins' ); 
     317add_action( 'load-update-core.php', 'wp_update_plugins' ); 
    317318add_action( 'admin_init', '_maybe_update_plugins' ); 
    318319add_action( 'wp_update_plugins', 'wp_update_plugins' ); 
Note: See TracChangeset for help on using the changeset viewer.