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

git-svn-id: https://develop.svn.wordpress.org/trunk@15469 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-07-24 03:59:53 +00:00
parent 7c3292bb4a
commit 2ea4fcd6d9

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;
}
}
}
}