Index: src/wp-admin/includes/class-plugin-upgrader.php
===================================================================
--- src/wp-admin/includes/class-plugin-upgrader.php	(revision 39205)
+++ src/wp-admin/includes/class-plugin-upgrader.php	(working copy)
@@ -156,32 +156,34 @@ class Plugin_Upgrader extends WP_Upgrade
 		$current = get_site_transient( 'update_plugins' );
 		if ( !isset( $current->response[ $plugin ] ) ) {
 			$this->skin->before();
 			$this->skin->set_result(false);
 			$this->skin->error('up_to_date');
 			$this->skin->after();
 			return false;
 		}
 
 		// Get the URL to the zip file
 		$r = $current->response[ $plugin ];
 
 		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);
 		//'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
-		// Clear cache so wp_update_plugins() knows about the new plugin.
-		add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Clear cache so wp_update_plugins() knows about the new plugin.
+			add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
+		}
 
 		$this->run( array(
 			'package' => $r->package,
 			'destination' => WP_PLUGIN_DIR,
 			'clear_destination' => true,
 			'clear_working' => true,
 			'hook_extra' => array(
 				'plugin' => $plugin,
 				'type' => 'plugin',
 				'action' => 'update',
 			),
 		) );
 
 		// Cleanup our hooks, in case something else does a upgrade on this connection.
 		remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
@@ -215,31 +217,30 @@ class Plugin_Upgrader extends WP_Upgrade
 	 */
 	public function bulk_upgrade( $plugins, $args = array() ) {
 
 		$defaults = array(
 			'clear_update_cache' => true,
 		);
 		$parsed_args = wp_parse_args( $args, $defaults );
 
 		$this->init();
 		$this->bulk = true;
 		$this->upgrade_strings();
 
 		$current = get_site_transient( 'update_plugins' );
 
 		add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
-		add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
 
 		$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->skin->bulk_header();
 
 		/*
 		 * Only start maintenance mode if:
 		 * - running Multisite and there are one or more plugins specified, OR
@@ -282,49 +283,48 @@ class Plugin_Upgrader extends WP_Upgrade
 				'is_multi' => true,
 				'hook_extra' => array(
 					'plugin' => $plugin
 				)
 			) );
 
 			$results[$plugin] = $this->result;
 
 			// Prevent credentials auth screen from displaying multiple times
 			if ( false === $result )
 				break;
 		} //end foreach $plugins
 
 		$this->maintenance_mode(false);
 
+		// Force refresh of plugin update information.
+		wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
+
 		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
 		do_action( 'upgrader_process_complete', $this, array(
 			'action' => 'update',
 			'type' => 'plugin',
 			'bulk' => true,
 			'plugins' => $plugins,
 		) );
 
 		$this->skin->bulk_footer();
 
 		$this->skin->footer();
 
 		// Cleanup our hooks, in case something else does a upgrade on this connection.
-		remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
 		remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
 
-		// Force refresh of plugin update information.
-		wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
-
 		return $results;
 	}
 
 	/**
 	 * Check a source package to be sure it contains a plugin.
 	 *
 	 * This function is added to the {@see 'upgrader_source_selection'} filter by
 	 * Plugin_Upgrader::install().
 	 *
 	 * @since 3.3.0
 	 * @access public
 	 *
 	 * @global WP_Filesystem_Base $wp_filesystem Subclass
 	 *
 	 * @param string $source The path to the downloaded package source.
Index: src/wp-admin/includes/class-theme-upgrader.php
===================================================================
--- src/wp-admin/includes/class-theme-upgrader.php	(revision 39205)
+++ src/wp-admin/includes/class-theme-upgrader.php	(working copy)
@@ -189,32 +189,34 @@ class Theme_Upgrader extends WP_Upgrader
 	 *
 	 * @return bool|WP_Error True if the install was successful, false or a WP_Error object otherwise.
 	 */
 	public function install( $package, $args = array() ) {
 
 		$defaults = array(
 			'clear_update_cache' => true,
 		);
 		$parsed_args = wp_parse_args( $args, $defaults );
 
 		$this->init();
 		$this->install_strings();
 
 		add_filter('upgrader_source_selection', array($this, 'check_package') );
 		add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
-		// Clear cache so wp_update_themes() knows about the new theme.
-		add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Clear cache so wp_update_themes() knows about the new theme.
+			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+		}
 
 		$this->run( array(
 			'package' => $package,
 			'destination' => get_theme_root(),
 			'clear_destination' => false, //Do not overwrite files.
 			'clear_working' => true,
 			'hook_extra' => array(
 				'type' => 'theme',
 				'action' => 'install',
 			),
 		) );
 
 		remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
 		remove_filter('upgrader_source_selection', array($this, 'check_package') );
 		remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
@@ -257,32 +259,34 @@ class Theme_Upgrader extends WP_Upgrader
 		// Is an update available?
 		$current = get_site_transient( 'update_themes' );
 		if ( !isset( $current->response[ $theme ] ) ) {
 			$this->skin->before();
 			$this->skin->set_result(false);
 			$this->skin->error( 'up_to_date' );
 			$this->skin->after();
 			return false;
 		}
 
 		$r = $current->response[ $theme ];
 
 		add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
 		add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
 		add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
-		// Clear cache so wp_update_themes() knows about the new theme.
-		add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Clear cache so wp_update_themes() knows about the new theme.
+			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
+		}
 
 		$this->run( array(
 			'package' => $r['package'],
 			'destination' => get_theme_root( $theme ),
 			'clear_destination' => true,
 			'clear_working' => true,
 			'hook_extra' => array(
 				'theme' => $theme,
 				'type' => 'theme',
 				'action' => 'update',
 			),
 		) );
 
 		remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
 		remove_filter('upgrader_pre_install', array($this, 'current_before'));
@@ -317,32 +321,30 @@ class Theme_Upgrader extends WP_Upgrader
 
 		$defaults = array(
 			'clear_update_cache' => true,
 		);
 		$parsed_args = wp_parse_args( $args, $defaults );
 
 		$this->init();
 		$this->bulk = true;
 		$this->upgrade_strings();
 
 		$current = get_site_transient( 'update_themes' );
 
 		add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
 		add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
 		add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
-		// Clear cache so wp_update_themes() knows about the new theme.
-		add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
 
 		$this->skin->header();
 
 		// Connect to the Filesystem first.
 		$res = $this->fs_connect( array(WP_CONTENT_DIR) );
 		if ( ! $res ) {
 			$this->skin->footer();
 			return false;
 		}
 
 		$this->skin->bulk_header();
 
 		// Only start maintenance mode if:
 		// - running Multisite and there are one or more themes specified, OR
 		// - a theme with an update available is currently in use.
@@ -382,51 +384,50 @@ class Theme_Upgrader extends WP_Upgrader
 				'is_multi' => true,
 				'hook_extra' => array(
 					'theme' => $theme
 				),
 			) );
 
 			$results[$theme] = $this->result;
 
 			// Prevent credentials auth screen from displaying multiple times
 			if ( false === $result )
 				break;
 		} //end foreach $plugins
 
 		$this->maintenance_mode(false);
 
+		// Refresh the Theme Update information
+		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
+
 		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
 		do_action( 'upgrader_process_complete', $this, array(
 			'action' => 'update',
 			'type' => 'theme',
 			'bulk' => true,
 			'themes' => $themes,
 		) );
 
 		$this->skin->bulk_footer();
 
 		$this->skin->footer();
 
 		// Cleanup our hooks, in case something else does a upgrade on this connection.
-		remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
 		remove_filter('upgrader_pre_install', array($this, 'current_before'));
 		remove_filter('upgrader_post_install', array($this, 'current_after'));
 		remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
 
-		// Refresh the Theme Update information
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
-
 		return $results;
 	}
 
 	/**
 	 * Check that the package source contains a valid theme.
 	 *
 	 * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
 	 * It will return an error if the theme doesn't have style.css or index.php
 	 * files.
 	 *
 	 * @since 3.3.0
 	 * @access public
 	 *
 	 * @global WP_Filesystem_Base $wp_filesystem Subclass
 	 *
