X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a5227bf01edbe6660486c9f5c0f0ed7b7fea3130..f9001779751f83dc8a10e478bfecb4d8dd5f964c:/wp-admin/includes/class-wp-upgrader.php diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 28185fce..3b5ab902 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -368,14 +368,14 @@ class Plugin_Upgrader extends WP_Upgrader { function upgrade_strings() { $this->strings['up_to_date'] = __('The plugin is at the latest version.'); - $this->strings['no_package'] = __('Upgrade package not available.'); + $this->strings['no_package'] = __('Update package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s…'); $this->strings['unpack_package'] = __('Unpacking the update…'); $this->strings['deactivate_plugin'] = __('Deactivating the plugin…'); $this->strings['remove_old'] = __('Removing the old version of the plugin…'); $this->strings['remove_old_failed'] = __('Could not remove the old plugin.'); - $this->strings['process_failed'] = __('Plugin upgrade failed.'); - $this->strings['process_success'] = __('Plugin upgraded successfully.'); + $this->strings['process_failed'] = __('Plugin update failed.'); + $this->strings['process_success'] = __('Plugin updated successfully.'); } function install_strings() { @@ -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(); @@ -603,13 +608,13 @@ class Theme_Upgrader extends WP_Upgrader { function upgrade_strings() { $this->strings['up_to_date'] = __('The theme is at the latest version.'); - $this->strings['no_package'] = __('Upgrade package not available.'); + $this->strings['no_package'] = __('Update package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s…'); $this->strings['unpack_package'] = __('Unpacking the update…'); $this->strings['remove_old'] = __('Removing the old version of the theme…'); $this->strings['remove_old_failed'] = __('Could not remove the old theme.'); - $this->strings['process_failed'] = __('Theme upgrade failed.'); - $this->strings['process_success'] = __('Theme upgraded successfully.'); + $this->strings['process_failed'] = __('Theme update failed.'); + $this->strings['process_success'] = __('Theme updated successfully.'); } function install_strings() { @@ -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; @@ -850,7 +861,7 @@ class Core_Upgrader extends WP_Upgrader { function upgrade_strings() { $this->strings['up_to_date'] = __('WordPress is at the latest version.'); - $this->strings['no_package'] = __('Upgrade package not available.'); + $this->strings['no_package'] = __('Update package not available.'); $this->strings['downloading_package'] = __('Downloading update from %s…'); $this->strings['unpack_package'] = __('Unpacking the update…'); $this->strings['copy_failed'] = __('Could not copy files.'); @@ -1006,7 +1017,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { } function __construct($args = array()) { - $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Upgrade Plugin') ); + $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') ); $args = wp_parse_args($args, $defaults); $this->plugin = $args['plugin']; @@ -1026,7 +1037,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { $update_actions = array( 'activate_plugin' => '' . __('Activate Plugin') . '', - 'plugins_page' => '' . __('Return to Plugins page') . '' + 'plugins_page' => '' . __('Return to Plugins page') . '' ); if ( $this->plugin_active ) unset( $update_actions['activate_plugin'] ); @@ -1035,7 +1046,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin); if ( ! empty($update_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions)); + $this->feedback(implode(' | ', (array)$update_actions)); } function before() { @@ -1069,8 +1080,8 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { } function add_strings() { - $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take awhile on some hosts, so please be patient.'); - $this->upgrader->strings['skin_update_failed_error'] = __('An error occured while updating %1$s: %2$s.'); + $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.'); + $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s.'); $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.'); $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').'.'; $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.'); @@ -1184,13 +1195,13 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin { function bulk_footer() { parent::bulk_footer(); $update_actions = array( - 'plugins_page' => '' . __('Return to Plugins page') . '', - 'updates_page' => '' . __('Return to WordPress Updates') . '' + 'plugins_page' => '' . __('Return to Plugins page') . '', + 'updates_page' => '' . __('Return to WordPress Updates') . '' ); $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info); if ( ! empty($update_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions)); + $this->feedback(implode(' | ', (array)$update_actions)); } } @@ -1215,13 +1226,13 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin { function bulk_footer() { parent::bulk_footer(); $update_actions = array( - 'themes_page' => '' . __('Return to Themes page') . '', - 'updates_page' => '' . __('Return to WordPress Updates') . '' + 'themes_page' => '' . __('Return to Themes page') . '', + 'updates_page' => '' . __('Return to WordPress Updates') . '' ); $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info); if ( ! empty($update_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions)); + $this->feedback(implode(' | ', (array)$update_actions)); } } @@ -1270,15 +1281,17 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { else $install_actions['activate_plugin'] = '' . __('Activate Plugin') . ''; - if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) - $install_actions['network_activate'] = '' . __('Network Activate') . ''; + if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { + $install_actions['network_activate'] = '' . __('Network Activate') . ''; + unset( $install_actions['activate_plugin'] ); + } if ( 'import' == $from ) $install_actions['importers_page'] = '' . __('Return to Importers') . ''; else if ( $this->type == 'web' ) - $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ''; + $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ''; else - $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ''; + $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ''; if ( ! $this->result || is_wp_error($this->result) ) { @@ -1287,7 +1300,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { } $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); if ( ! empty($install_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$install_actions)); + $this->feedback(implode(' | ', (array)$install_actions)); } } @@ -1345,16 +1358,16 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin { ); if ( $this->type == 'web' ) - $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ''; + $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ''; else - $install_actions['themes_page'] = '' . __('Return to Themes page') . ''; + $install_actions['themes_page'] = '' . __('Return to Themes page') . ''; - if ( ! $this->result || is_wp_error($this->result) ) + if ( ! $this->result || is_wp_error($this->result) || is_network_admin() ) unset( $install_actions['activate'], $install_actions['preview'] ); $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info); if ( ! empty($install_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$install_actions)); + $this->feedback(implode(' | ', (array)$install_actions)); } } @@ -1375,7 +1388,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { } function __construct($args = array()) { - $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Upgrade Theme') ); + $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') ); $args = wp_parse_args($args, $defaults); $this->theme = $args['theme']; @@ -1404,11 +1417,11 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin { unset($update_actions['preview'], $update_actions['activate']); } - $update_actions['themes_page'] = '' . __('Return to Themes page') . ''; + $update_actions['themes_page'] = '' . __('Return to Themes page') . ''; $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme); if ( ! empty($update_actions) ) - $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions)); + $this->feedback(implode(' | ', (array)$update_actions)); } } @@ -1452,4 +1465,4 @@ class File_Upload_Upgrader { $this->package = $uploads['basedir'] . '/' . $this->filename; } } -} +} \ No newline at end of file