Index: wp-admin/includes/plugin.php
===================================================================
--- wp-admin/includes/plugin.php	(revision 20738)
+++ wp-admin/includes/plugin.php	(working copy)
@@ -522,11 +522,16 @@
 			do_action( 'activate_plugin', $plugin, $network_wide );
 			do_action( 'activate_' . $plugin, $network_wide );
 		}
-
 		if ( $network_wide ) {
+			// Check active_plugins again - the activated plugin may have activated
+			// other plugins during activation.
+			$current = get_site_option( 'active_sitewide_plugins', array() );
 			$current[$plugin] = time();
 			update_site_option( 'active_sitewide_plugins', $current );
 		} else {
+			// Check active_sitewide_plugins again - the activated plugin may have
+			// activated other plugins during activation.
+			$current = get_option( 'active_plugins', array() );
 			$current[] = $plugin;
 			sort($current);
 			update_option('active_plugins', $current);
@@ -558,9 +563,6 @@
  * @param bool $silent Prevent calling deactivation hooks. Default is false.
  */
 function deactivate_plugins( $plugins, $silent = false ) {
-	if ( is_multisite() )
-		$network_current = get_site_option( 'active_sitewide_plugins', array() );
-	$current = get_option( 'active_plugins', array() );
 	$do_blog = $do_network = false;
 
 	foreach ( (array) $plugins as $plugin ) {
@@ -570,8 +572,17 @@
 
 		$network_wide = is_plugin_active_for_network( $plugin );
 
-		if ( ! $silent )
+		if ( ! $silent ) {
 			do_action( 'deactivate_plugin', $plugin, $network_wide );
+			do_action( 'deactivate_' . $plugin, $network_wide );
+			do_action( 'deactivated_plugin', $plugin, $network_wide );
+		}
+		
+		// Check active plugins now, not earlier - the activated plugin may have 
+		// deactivated other plugins during deactivation.
+		if ( is_multisite() )
+		  $network_current = get_site_option( 'active_sitewide_plugins', array() );
+		$current = get_option( 'active_plugins', array() );
 
 		if ( $network_wide ) {
 			$do_network = true;
@@ -583,17 +594,12 @@
 				array_splice( $current, $key, 1 );
 			}
 		}
-
-		if ( ! $silent ) {
-			do_action( 'deactivate_' . $plugin, $network_wide );
-			do_action( 'deactivated_plugin', $plugin, $network_wide );
-		}
+		
+		if ( $do_blog )
+		  update_option('active_plugins', $current);
+		if ( $do_network )
+		  update_site_option( 'active_sitewide_plugins', $network_current );
 	}
-
-	if ( $do_blog )
-		update_option('active_plugins', $current);
-	if ( $do_network )
-		update_site_option( 'active_sitewide_plugins', $network_current );
 }
 
 /**
