Put site into maintenance mode during bulk plugin upgrade. Skip plugin deactivate/activate. Add compatibility info. see #10973
git-svn-id: https://develop.svn.wordpress.org/trunk@12157 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2cd5ea2a14
commit
ef2c943123
@ -432,7 +432,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
//Cleanup our hooks, incase something else does a upgrade on this connection.
|
// Cleanup our hooks, incase something else does a upgrade on this connection.
|
||||||
remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
|
remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
|
||||||
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
|
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
|
||||||
|
|
||||||
@ -451,10 +451,19 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
$current = get_transient( 'update_plugins' );
|
$current = get_transient( 'update_plugins' );
|
||||||
|
|
||||||
add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
|
|
||||||
add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
|
add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
|
||||||
|
|
||||||
$this->skin->header();
|
$this->skin->header();
|
||||||
|
|
||||||
|
// Connect to the Filesystem first.
|
||||||
|
$res = $this->fs_connect( array(WP_CONTENT_DIR, WP_PLUGIN_DIR) );
|
||||||
|
if ( ! $res ) {
|
||||||
|
$this->skin->footer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->maintenance_mode(true);
|
||||||
|
|
||||||
$all = count($plugins);
|
$all = count($plugins);
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach ( $plugins as $plugin ) {
|
foreach ( $plugins as $plugin ) {
|
||||||
@ -492,10 +501,10 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
if ( false === $result )
|
if ( false === $result )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$this->maintenance_mode(false);
|
||||||
$this->skin->footer();
|
$this->skin->footer();
|
||||||
|
|
||||||
//Cleanup our hooks, incase something else does a upgrade on this connection.
|
// Cleanup our hooks, incase something else does a upgrade on this connection.
|
||||||
remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
|
|
||||||
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
|
remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
|
||||||
|
|
||||||
// Force refresh of plugin update information
|
// Force refresh of plugin update information
|
||||||
@ -899,11 +908,15 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function after() {
|
function after() {
|
||||||
|
if ( $this->upgrader->bulk )
|
||||||
|
return;
|
||||||
|
|
||||||
$this->plugin = $this->upgrader->plugin_info();
|
$this->plugin = $this->upgrader->plugin_info();
|
||||||
if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
|
if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
|
||||||
show_message(__('Attempting reactivation of the plugin'));
|
show_message(__('Attempting reactivation of the plugin'));
|
||||||
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>';
|
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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_actions = array(
|
$update_actions = array(
|
||||||
'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
|
'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
|
||||||
'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
|
'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
|
||||||
|
@ -133,6 +133,11 @@ function core_upgrade_preamble() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function list_plugin_updates() {
|
function list_plugin_updates() {
|
||||||
|
global $wp_version;
|
||||||
|
|
||||||
|
$cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
|
||||||
|
|
||||||
|
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
|
||||||
$plugins = get_plugin_updates();
|
$plugins = get_plugin_updates();
|
||||||
if ( empty($plugins) )
|
if ( empty($plugins) )
|
||||||
return;
|
return;
|
||||||
@ -160,10 +165,17 @@ function list_plugin_updates() {
|
|||||||
<tbody class="plugins">
|
<tbody class="plugins">
|
||||||
<?php
|
<?php
|
||||||
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
|
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
|
||||||
|
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
|
||||||
|
if ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) {
|
||||||
|
$compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version];
|
||||||
|
$compat = ' ' . sprintf(__('Compatibility: %1$d%% (%2$d "works" votes out of %3$d total)'), $compat[0], $compat[2], $compat[1]);
|
||||||
|
} else {
|
||||||
|
$compat = '';
|
||||||
|
}
|
||||||
echo "
|
echo "
|
||||||
<tr class='active'>
|
<tr class='active'>
|
||||||
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
|
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
|
||||||
<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>
|
<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>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -300,8 +312,6 @@ function do_plugin_upgrade() {
|
|||||||
$url = 'update-core.php?action=do-plugin-upgrade&plugins=' . urlencode(join(',', $plugins));
|
$url = 'update-core.php?action=do-plugin-upgrade&plugins=' . urlencode(join(',', $plugins));
|
||||||
$title = __('Upgrade Plugins');
|
$title = __('Upgrade Plugins');
|
||||||
$nonce = 'upgrade-core';
|
$nonce = 'upgrade-core';
|
||||||
add_filter('update_plugin_complete_actions', 'no_update_actions');
|
|
||||||
|
|
||||||
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
|
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
|
||||||
$upgrader->bulk_upgrade($plugins);
|
$upgrader->bulk_upgrade($plugins);
|
||||||
}
|
}
|
||||||
|
@ -314,6 +314,7 @@ add_action( 'wp_version_check', 'wp_version_check' );
|
|||||||
|
|
||||||
add_action( 'load-plugins.php', 'wp_update_plugins' );
|
add_action( 'load-plugins.php', 'wp_update_plugins' );
|
||||||
add_action( 'load-update.php', 'wp_update_plugins' );
|
add_action( 'load-update.php', 'wp_update_plugins' );
|
||||||
|
add_action( 'load-update-core.php', 'wp_update_plugins' );
|
||||||
add_action( 'admin_init', '_maybe_update_plugins' );
|
add_action( 'admin_init', '_maybe_update_plugins' );
|
||||||
add_action( 'wp_update_plugins', 'wp_update_plugins' );
|
add_action( 'wp_update_plugins', 'wp_update_plugins' );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user