Only use maintenance_mode() for ( is_multisite() || (plugin|theme) being updated is in use ) with Plugin|Theme Bulk Upgrades. See #14393

git-svn-id: http://svn.automattic.com/wordpress/trunk@15469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-07-24 03:59:53 +00:00
parent 9f1d1ba7fa
commit 7ffe984f8e
1 changed files with 16 additions and 5 deletions

View File

@ -468,7 +468,12 @@ class Plugin_Upgrader extends WP_Upgrader {
$this->skin->bulk_header();
$this->maintenance_mode(true);
// Only start maintenance mode if running in Multisite OR the plugin is in use
$maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
foreach ( $plugins as $plugin )
$maintenance = $maintenance || (is_plugin_active($plugin) && isset($current->response[ $plugin ]) ); // Only activate Maintenance mode if a plugin is active AND has an update available
if ( $maintenance )
$this->maintenance_mode(true);
$results = array();
@ -712,7 +717,12 @@ class Theme_Upgrader extends WP_Upgrader {
$this->skin->bulk_header();
$this->maintenance_mode(true);
// Only start maintenance mode if running in Multisite OR the theme is in use
$maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
foreach ( $themes as $theme )
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
if ( $maintenance )
$this->maintenance_mode(true);
$results = array();
@ -780,7 +790,7 @@ class Theme_Upgrader extends WP_Upgrader {
if ( $theme != get_stylesheet() ) //If not current
return $return;
//Change to maintainence mode now.
//Change to maintenance mode now.
if ( ! $this->bulk )
$this->maintenance_mode(true);
@ -796,6 +806,7 @@ class Theme_Upgrader extends WP_Upgrader {
return $return;
//Ensure stylesheet name hasnt changed after the upgrade:
// @TODO: Note, This doesnt handle the Template changing, or the Template name changing.
if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
$theme_info = $this->theme_info();
$stylesheet = $this->result['destination_name'];
@ -803,7 +814,7 @@ class Theme_Upgrader extends WP_Upgrader {
switch_theme($template, $stylesheet, true);
}
//Time to remove maintainence mode
//Time to remove maintenance mode
if ( ! $this->bulk )
$this->maintenance_mode(false);
return $return;
@ -1452,4 +1463,4 @@ class File_Upload_Upgrader {
$this->package = $uploads['basedir'] . '/' . $this->filename;
}
}
}
}