Index: src/wp-admin/includes/class-wp-upgrader.php
===================================================================
--- src/wp-admin/includes/class-wp-upgrader.php	(revision 25227)
+++ src/wp-admin/includes/class-wp-upgrader.php	(working copy)
@@ -166,10 +166,13 @@
 	function install_package($args = array()) {
 		global $wp_filesystem, $wp_theme_directories;
 
-		$defaults = array( 'source' => '', 'destination' => '', //Please always pass these
-						'clear_destination' => false, 'clear_working' => false,
-						'abort_if_destination_exists' => true,
-						'hook_extra' => array());
+		$defaults = array(
+			'source' => '', // Please always pass these
+			'destination' => '', // and this
+			'clear_destination' => false, 'clear_working' => false,
+			'abort_if_destination_exists' => true,
+			'hook_extra' => array()
+		);
 
 		$args = wp_parse_args($args, $defaults);
 		extract($args);
@@ -277,14 +280,15 @@
 
 	function run($options) {
 
-		$defaults = array( 	'package' => '', //Please always pass this.
-							'destination' => '', //And this
-							'clear_destination' => false,
-							'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
-							'clear_working' => true,
-							'is_multi' => false,
-							'hook_extra' => array() //Pass any extra $hook_extra args here, this will be passed to any hooked filters.
-						);
+		$defaults = array(
+			'package' => '', // Please always pass this.
+			'destination' => '', // And this
+			'clear_destination' => false,
+			'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
+			'clear_working' => true,
+			'is_multi' => false,
+			'hook_extra' => array() // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
+		);
 
 		$options = wp_parse_args($options, $defaults);
 		extract($options);
@@ -324,13 +328,14 @@
 
 		//With the given options, this installs it to the destination directory.
 		$result = $this->install_package( array(
-											'source' => $working_dir,
-											'destination' => $destination,
-											'clear_destination' => $clear_destination,
-											'abort_if_destination_exists' => $abort_if_destination_exists,
-											'clear_working' => $clear_working,
-											'hook_extra' => $hook_extra
-										) );
+			'source' => $working_dir,
+			'destination' => $destination,
+			'clear_destination' => $clear_destination,
+			'abort_if_destination_exists' => $abort_if_destination_exists,
+			'clear_working' => $clear_working,
+			'hook_extra' => $hook_extra
+		) );
+
 		$this->skin->set_result($result);
 		if ( is_wp_error($result) ) {
 			$this->skin->error($result);
@@ -398,36 +403,49 @@
 		$this->strings['process_success'] = __('Plugin installed successfully.');
 	}
 
-	function install($package) {
+	function install( $package, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->install_strings();
 
 		add_filter('upgrader_source_selection', array(&$this, 'check_package') );
 
-		$this->run(array(
-					'package' => $package,
-					'destination' => WP_PLUGIN_DIR,
-					'clear_destination' => false, //Do not overwrite files.
-					'clear_working' => true,
-					'hook_extra' => array()
-					));
+		$this->run( array(
+			'package' => $package,
+			'destination' => WP_PLUGIN_DIR,
+			'clear_destination' => false, //Do not overwrite files.
+			'clear_working' => true,
+			'hook_extra' => array()
+		) );
 
 		remove_filter('upgrader_source_selection', array(&$this, 'check_package') );
 
 		if ( ! $this->result || is_wp_error($this->result) )
 			return $this->result;
 
-		// Force refresh of plugin update information
-		delete_site_transient('update_plugins');
-		wp_cache_delete( 'plugins', 'plugins' );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of plugin update information
+			delete_site_transient('update_plugins');
+			wp_cache_delete( 'plugins', 'plugins' );
+		}
+
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'plugin' ), $package );
 
 		return true;
 	}
 
-	function upgrade($plugin) {
+	function upgrade( $plugin, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->upgrade_strings();
 
@@ -447,15 +465,15 @@
 		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.
 
-		$this->run(array(
-					'package' => $r->package,
-					'destination' => WP_PLUGIN_DIR,
-					'clear_destination' => true,
-					'clear_working' => true,
-					'hook_extra' => array(
-								'plugin' => $plugin
-					)
-				));
+		$this->run( array(
+			'package' => $r->package,
+			'destination' => WP_PLUGIN_DIR,
+			'clear_destination' => true,
+			'clear_working' => true,
+			'hook_extra' => array(
+				'plugin' => $plugin
+			),
+		) );
 
 		// Cleanup our hooks, in case something else does a upgrade on this connection.
 		remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
@@ -464,16 +482,24 @@
 		if ( ! $this->result || is_wp_error($this->result) )
 			return $this->result;
 
-		// Force refresh of plugin update information
-		delete_site_transient('update_plugins');
-		wp_cache_delete( 'plugins', 'plugins' );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of plugin update information
+			delete_site_transient('update_plugins');
+			wp_cache_delete( 'plugins', 'plugins' );
+		}
+
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin' ), $plugin );
 
 		return true;
 	}
 
-	function bulk_upgrade($plugins) {
+	function bulk_upgrade( $plugins, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->bulk = true;
 		$this->upgrade_strings();
@@ -525,16 +551,16 @@
 
 			$this->skin->plugin_active = is_plugin_active($plugin);
 
-			$result = $this->run(array(
-						'package' => $r->package,
-						'destination' => WP_PLUGIN_DIR,
-						'clear_destination' => true,
-						'clear_working' => true,
-						'is_multi' => true,
-						'hook_extra' => array(
-									'plugin' => $plugin
-						)
-					));
+			$result = $this->run( array(
+				'package' => $r->package,
+				'destination' => WP_PLUGIN_DIR,
+				'clear_destination' => true,
+				'clear_working' => true,
+				'is_multi' => true,
+				'hook_extra' => array(
+					'plugin' => $plugin
+				)
+			) );
 
 			$results[$plugin] = $this->result;
 
@@ -552,9 +578,12 @@
 		// Cleanup our hooks, in case something else does a upgrade on this connection.
 		remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
 
-		// Force refresh of plugin update information
-		delete_site_transient('update_plugins');
-		wp_cache_delete( 'plugins', 'plugins' );
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of plugin update information
+			delete_site_transient('update_plugins');
+			wp_cache_delete( 'plugins', 'plugins' );
+		}
+
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true ), $plugins );
 
 		return $results;
@@ -755,38 +784,49 @@
 		return $actions;
 	}
 
-	function install($package) {
+	function install( $package, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$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);
 
-		$options = array(
+		$this->run( array(
 			'package' => $package,
 			'destination' => get_theme_root(),
 			'clear_destination' => false, //Do not overwrite files.
 			'clear_working' => true
-		);
+		) );
 
-		$this->run($options);
-
 		remove_filter('upgrader_source_selection', array(&$this, 'check_package') );
 		remove_filter('upgrader_post_install', array(&$this, 'check_parent_theme_filter'));
 
 		if ( ! $this->result || is_wp_error($this->result) )
 			return $this->result;
 
-		// Force refresh of theme update information
-		wp_clean_themes_cache();
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of theme update information
+			wp_clean_themes_cache();
+		}
+
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'theme' ), $package );
 
 		return true;
 	}
 
-	function upgrade($theme) {
+	function upgrade( $theme, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->upgrade_strings();
 
@@ -806,7 +846,7 @@
 		add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
 		add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
 
-		$options = array(
+		$this->run( array(
 			'package' => $r['package'],
 			'destination' => get_theme_root( $theme ),
 			'clear_destination' => true,
@@ -814,10 +854,8 @@
 			'hook_extra' => array(
 				'theme' => $theme
 			),
-		);
+		) );
 
-		$this->run($options);
-
 		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'));
@@ -825,15 +863,22 @@
 		if ( ! $this->result || is_wp_error($this->result) )
 			return $this->result;
 
-		// Force refresh of theme update information
-		wp_clean_themes_cache();
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of theme update information
+			wp_clean_themes_cache();
+		}
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme' ), $theme );
 
 		return true;
 	}
 
-	function bulk_upgrade($themes) {
+	function bulk_upgrade( $themes, $args = array() ) {
 
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->bulk = true;
 		$this->upgrade_strings();
@@ -886,7 +931,7 @@
 			// Get the URL to the zip file
 			$r = $current->response[ $theme ];
 
-			$options = array(
+			$result = $this->run( array(
 				'package' => $r['package'],
 				'destination' => get_theme_root( $theme ),
 				'clear_destination' => true,
@@ -894,10 +939,8 @@
 				'hook_extra' => array(
 					'theme' => $theme
 				),
-			);
+			) );
 
-			$result = $this->run($options);
-
 			$results[$theme] = $this->result;
 
 			// Prevent credentials auth screen from displaying multiple times
@@ -916,8 +959,11 @@
 		remove_filter('upgrader_post_install', array(&$this, 'current_after'));
 		remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'));
 
-		// Force refresh of theme update information
-		wp_clean_themes_cache();
+		if ( $parsed_args['clear_update_cache'] ) {
+			// Force refresh of theme update information
+			wp_clean_themes_cache();
+		}
+
 		do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true ), $themes );
 
 		return $results;
@@ -1038,9 +1084,13 @@
 		$this->strings['copy_failed_space'] = __('Could not copy files. You may have run out of disk space.' );
 	}
 
-	function upgrade($current) {
+	function upgrade( $current, $args = array() ) {
 		global $wp_filesystem, $wp_version;
 
+		$defaults = array(
+		);
+		$parsed_args = wp_parse_args( $defaults, $args );
+
 		$this->init();
 		$this->upgrade_strings();
 
Index: src/wp-content/mu-plugins/background-upgrader.php
===================================================================
--- src/wp-content/mu-plugins/background-upgrader.php	(revision 0)
+++ src/wp-content/mu-plugins/background-upgrader.php	(working copy)
@@ -0,0 +1,381 @@
+<?php
+
+class WP_Background_Upgrader {
+
+	static $skin;
+
+	static function init() {
+
+		// Detect updates for Core, Plugins, and, Themes
+		add_action( 'set_site_transient_' . 'update_core',    array( 'WP_Background_Upgrader', 'queue_updates_check_core' ) );
+		add_action( 'set_site_transient_' . 'update_plugins', array( 'WP_Background_Upgrader', 'queue_updates_check_plugins_themes' ) );
+		add_action( 'set_site_transient_' . 'update_themes',  array( 'WP_Background_Upgrader', 'queue_updates_check_plugins_themes' ) );
+		// Uh.. Yeah, work around for #25213
+		add_action( 'set_site_transient_' . '_site_transient_' . 'update_core',    array( 'WP_Background_Upgrader', 'queue_updates_check_core' ) );
+		add_action( 'set_site_transient_' . '_site_transient_' . 'update_plugins', array( 'WP_Background_Upgrader', 'queue_updates_check_plugins_themes' ) );
+		add_action( 'set_site_transient_' . '_site_transient_' . 'update_themes',  array( 'WP_Background_Upgrader', 'queue_updates_check_plugins_themes' ) );
+
+		// Cron Updates
+		add_action( 'wp_background_upgrader_process', array( 'WP_Background_Upgrader', 'perform_queued_updates' ) );
+
+		// Temporary way of testing to see if the install is fataling
+		// Used with WP_Background_Upgrader::test_if_site_is_ok()
+		add_action( 'template_redirect', array( 'WP_Background_Upgrader','test_if_site_is_ok_callback' ) , 1 );
+
+	}
+
+	/**
+	 * Loads the WordPress Admin environment for performing the updates.
+	 * Cron runs as a front-end process
+	 */
+	static function load_required_admin_includes() {
+		error_reporting( E_ALL );
+		// include ABSPATH . 'wp-admin/includes/admin.php'; // Load the whole lot of 'em
+		include ABSPATH . 'wp-admin/includes/update.php';
+		include ABSPATH . 'wp-admin/includes/plugin.php';
+		include ABSPATH . 'wp-admin/includes/plugin-install.php';
+		include ABSPATH . 'wp-admin/includes/theme.php';
+		include ABSPATH . 'wp-admin/includes/theme-install.php';
+		include ABSPATH . 'wp-admin/includes/file.php';
+		include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+	}
+
+	static function queue_updates_check_core( $updates ) {
+
+		if ( self::upgrader_disabled() )
+			return;
+
+		if ( ! self::find_core_auto_update() )
+			return;
+
+		if ( ! wp_next_scheduled( 'wp_background_upgrader_process' ) ) {
+			// If the transient update was triggered by a user pageview, update in an hours time, else, now.
+			// What if the user is active in an hours time and maintainence mode kicks in?
+			// Schedule it for $user_id_1_timezone midnight?
+			$when_to_update = get_current_user_id() ? time() + HOUR_IN_SECONDS : time();
+			$when_to_update = apply_filters( 'auto_upgrade_when_to_upgrade', $when_to_update );
+
+			wp_schedule_single_event( $when_to_update, 'wp_background_upgrader_process' );
+		}
+	}
+
+	static function queue_updates_check_plugins_themes( $transient_value ) {
+
+		if ( self::upgrader_disabled() )
+			return;
+
+		if ( ! $transient_value || empty( $transient_value->response ) )
+			return;
+
+		if ( ! wp_next_scheduled( 'wp_auto_upgrader_upgrade_all_the_things' ) ) {
+			// If the transient update was triggered by a user pageview, update in an hours time, else, now.
+			$when_to_update = get_current_user_id() ? time() + HOUR_IN_SECONDS : time();
+			$when_to_update = apply_filters( 'auto_upgrade_when_to_upgrade', $when_to_update );
+
+			wp_schedule_single_event( $when_to_update, 'wp_auto_upgrader_upgrade_all_the_things' );
+		}
+
+	}
+
+	static function perform_queued_updates() {
+
+		$lock_name = 'auto_upgrader.lock';
+		if ( get_site_transient( $lock_name ) ) {
+			// Test to see if it was set more than an hour ago, if so, cleanup.
+			if ( true || get_site_transient( $lock_name ) < ( time() - HOUR_IN_SECONDS ) )
+				delete_site_transient( $lock_name );
+			else // Recent lock
+				return;
+		}
+		// Lock upgrades for us for half an hour
+		if ( ! set_site_transient( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) )
+			return;
+	
+		// Admin-ize ourselves
+		self::load_required_admin_includes();
+
+		// Next, Plugins
+		wp_update_plugins(); // Check for Plugin updates
+		$plugin_updates = get_site_transient( 'update_plugins' );
+		if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
+			foreach ( array_keys( $plugin_updates->response ) as $plugin ) {
+				self::upgrade( 'plugin', $plugin );
+			}
+			// Force refresh of plugin update information
+			delete_site_transient('update_plugins');
+			wp_cache_delete( 'plugins', 'plugins' );
+		}
+
+		// Next, those themes we all love
+		wp_update_themes();  // Check for Theme updates
+		$theme_updates = get_site_transient( 'update_themes' );
+		if ( $theme_updates && !empty( $theme_updates->response ) ) {
+			foreach ( array_keys( $theme_updates->response ) as $theme ) {
+				self::upgrade( 'theme', $theme );
+			}
+			// Force refresh of theme update information
+			wp_clean_themes_cache();
+		}
+
+		// Up first, Core.
+		wp_version_check(); // Check for Core updates
+		$core_update = self::find_core_auto_update();
+		if ( $core_update )
+			self::upgrade( 'core', $core_update );
+
+		// Cleanup, These won't trigger any updates this time due to the locking transient
+		wp_version_check();  // check for Core updates
+		wp_update_themes();  // Check for Theme updates
+		wp_update_plugins(); // Check for Plugin updates
+
+		delete_site_transient( $lock_name );
+
+	}
+
+	/**
+	 * Finds the best auto-update available for this site.
+	 * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the install allows it, else, 1.2.3
+	 */
+	static function find_core_auto_update() {
+		$updates = get_site_transient( 'update_core' );
+		$auto_update = false;
+		foreach ( $updates->updates as $update ) {
+			if ( 'autoupdate' != $update->response )
+				continue;
+
+			if ( ! self::should_upgrade( 'core', $update, ABSPATH ) )
+				continue;
+
+			if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )
+				$auto_update = $update;
+		}
+		return $auto_update;
+	}
+
+	static function upgrader_disabled() {
+		// That's a no if you don't want files changes
+		if ( defined( 'DISABLE_FILE_MODS' ) && DISABLE_FILE_MODS )
+			return true;
+
+		if ( defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED )
+			return true;
+
+		return apply_filters( 'auto_upgrader_disabled', false );
+	}
+
+	/**
+	 * Tests to see if we should upgrade a specific item, does not test to see if we CAN update the item.
+	 */
+	static function should_upgrade( $type, $item, $context ) {
+
+		if ( self::upgrader_disabled() )
+			return false;
+
+		// ..and also check for GIT/SVN checkouts
+		if ( ! apply_filters( 'auto_upgrade_ignore_checkout_status', false ) ) {
+			$stop_dirs = array(
+				ABSPATH,
+				untrailingslashit( $context ),
+			);
+			if ( ! file_exists( ABSPATH . '/wp-config.php' ) ) // wp-config.php up one folder in a deployment situation
+				$stop_dirs[] = dirname( ABSPATH );
+			foreach ( array_unique( $stop_dirs ) as $dir ) {
+				if ( file_exists( $dir . '/.svn' ) || file_exists( $dir . '/.git' ) )
+					return false;
+			}
+		}
+
+		// Next up, do we actually have it enabled for this type of update?
+		switch ( $type ) {
+			default:       $upgrade = false; break;
+			case 'core':
+				$upgrade = self::should_upgrade_to_core_version( $item->current );
+				break;
+			case 'plugin': $upgrade = false; break;
+			case 'theme':  $upgrade = false; break;
+			case 'lang':   $upgrade = false; break;
+		}
+
+		// And does the user / plugins want it?
+		if ( ! apply_filters( 'auto_upgrade_' . $type, $upgrade, $item ) )
+			return false;
+
+		// If it's a core update, are we actually compatible with it?
+		if ( 'core' == $type ) {
+			global $wpdb;
+
+			$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
+				$mysql_compat = true;
+			else
+				$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
+
+			if ( ! $php_compat || ! $mysql_compat )
+				return false;
+		}
+
+		// Make sure loop-back HTTP requests work, we need to be able to verify everything worked OK and to be able to upgrade the database
+		// If this doesn't pass, chances are they don't want auto-updates anyway
+		if ( ! self::test_if_site_is_ok() )
+			return false;
+
+		return true;
+	}
+
+	// Checks to see if WP_Filesystem is setup to allow unattended upgrades
+	static function can_upgrade( $context ) {
+		if ( ! self::$skin )
+			self::$skin = new WP_Background_Upgrader_Skin();
+		return (bool) self::$skin->request_filesystem_credentials();
+	}
+
+	// Determines if this WordPress Core version should update to $offered_ver or not
+	static function should_upgrade_to_core_version( $offered_ver /* x.y.z */ ) {
+		include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
+
+		$current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version  ), 0, 2 ) ); // x.y
+		$new_branch     = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
+		$current_is_development_version = (bool) strpos( $wp_version, '-' );
+
+		// Defaults:
+		$upgrade_dev   = false;
+		$upgrade_minor = true;
+		$upgrade_major = false;
+
+		// WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
+		if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
+			if ( false === WP_AUTO_UPDATE_CORE ) {
+				// Defaults to turned off, unless a filter allows it
+				$upgrade_dev = $upgrade_minor = $upgrade_major = false;
+			} elseif ( true === WP_AUTO_UPDATE_CORE ) {
+				// ALL updates for core
+				$upgrade_dev = $upgrade_minor = $upgrade_major = true;
+			} elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
+				// Only minor updates for core
+				$upgrade_dev = $upgrade_major = false;
+				$upgrade_minor = true;
+			}
+		}
+
+		// 1: If we're already on that version, not much point in updating?
+		if ( $offered_ver == $wp_version )
+			return false;
+
+		// 2: If we're running a newer version, that's a nope
+		if ( version_compare( $wp_version, $offered_ver, '>=' ) )
+			return false;
+
+		// 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2
+		if ( $current_is_development_version ) {
+			if ( ! apply_filters( 'allow_dev_background_core_updates', $upgrade_dev ) )
+				return false;
+			// else fall through to minor + major branches below
+		}
+
+		// 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
+		if ( $current_branch == $new_branch )
+			return apply_filters( 'allow_minor_background_core_updates', $upgrade_minor );
+
+		// 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1)
+		if ( version_compare( $new_branch, $current_branch, '>' ) )
+			return apply_filters( 'allow_major_background_core_updates', $upgrade_major );
+
+		// If we're not sure, we don't want it
+		return false;
+	}
+
+	static function upgrade( $type, $item ) {
+
+		wp_mail(
+			get_site_option( 'admin_email' ),
+			__METHOD__,
+			"Starting an upgrade for:\n\n" . var_export( compact( 'type', 'item' ), true ) . "\n\n" . wp_debug_backtrace_summary()
+		);
+
+		self::$skin = new Background_Upgrader_Skin();
+
+		switch( $type ) {
+			case 'core':
+				// Okay, Why does the Core upgrader not use the Upgrader's skin during the actual main part of the upgrade???
+				add_filter( 'update_feedback', function( $message ) {
+					WP_Background_Upgrader::$skin->feedback( $message );
+				} );
+				$upgrader = new Core_Upgrader( self::$skin );
+				$context  = ABSPATH;
+				break;
+			case 'plugin':
+				$upgrader = new Plugin_Upgrader( self::$skin );
+				$context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR
+				break;
+			case 'theme':
+				$upgrader = new Theme_Upgrader( self::$skin );
+				$context  = get_theme_root( $item );
+				break;
+			case 'lang':
+				return false; // Not quite yet!
+			//	$upgrader = new Language_Upgrader( self::$skin );
+				$context  = WP_LANG_DIR;
+				break;
+		}
+
+		// Determine if we can perform this upgrade or not
+		if ( ! self::should_upgrade( $type, $item, $context )  || ! self::can_upgrade( $context ) )
+			return false;
+
+		// Boom, This sites about to get a whole new splash of paint!
+		$upgrade_result = $upgrader->upgrade( $item, array(
+			'clear_update_cache' => false,
+		) );
+
+		// Core doesn't output this, so lets append it so we don't get confused
+		if ( 'core' == $type ) {
+			if ( is_wp_error( $upgrade_result ) ) {
+				self::$skin->error( __( 'Installation Failed' ), $upgrade_result );
+			} else {
+				self::$skin->feedback( __( 'WordPress updated successfully' ) );
+			}
+		}
+
+		var_dump( compact( 'type', 'item', 'upgrader', 'upgrade_result' ) );
+
+		wp_mail(
+			get_site_option( 'admin_email' ),
+			__METHOD__,
+			var_export( array(
+				$upgrade_result,
+				$upgrader,
+				self::$skin,
+			), true )
+		);
+
+		return $upgrade_result;
+	}
+
+	static function test_if_site_is_ok() {
+		// Is the Admin ajax handler returning what we expect of it? 
+		$http_result = wp_remote_get( admin_url( 'admin-ajax.php' ), array( 'timeout' => 10 ) );
+		$admin_ok = ! is_wp_error( $http_result ) && ( '0' === wp_remote_retrieve_body( $http_result ) );
+
+		// Is the front-end returning what we'd expect of it? (Note, this is a filter on template_redirect + wp_footer outside of this class below)
+		// This WILL break with caching plugins, Include a something that can be used to prevent the caching somehow? a GET parameter isn't enough for some caching plugins
+		$http_result = wp_remote_get( site_url('?test-upgrade-OK=1'), array( 'timeout' => 10 ) );
+		$front_ok = ! is_wp_error( $http_result ) && ( 'OK' === wp_remote_retrieve_body( $http_result ) );
+
+		return $admin_ok && $front_ok;
+	}
+
+	static function test_if_site_is_ok_callback() {
+		if ( ! isset( $_GET['test-upgrade-OK'] ) )
+			return;
+
+		ob_start();
+		add_action( 'wp_footer', function() {
+			ob_end_clean();
+			die( 'OK' );
+		}, 999 );
+	}
+
+	// A static lifestyle is best. Go on, try it, I dare you.
+	private function __construct() {}
+}
+WP_Background_Upgrader::init();

Property changes on: src/wp-content/mu-plugins/background-upgrader.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
