diff --git src/wp-admin/includes/class-plugin-upgrader.php src/wp-admin/includes/class-plugin-upgrader.php
index be5b926e4a..d85f311065 100644
--- src/wp-admin/includes/class-plugin-upgrader.php
+++ src/wp-admin/includes/class-plugin-upgrader.php
@@ -450,9 +450,9 @@ class Plugin_Upgrader extends WP_Upgrader {
 	 *
 	 * @since 5.4.0
 	 *
-	 * @param bool|WP_Error  $return
-	 * @param array          $plugin
-	 * @return bool|WP_Error
+	 * @param bool|WP_Error $return Upgrade offer return.
+	 * @param array         $plugin Plugin package arguments.
+	 * @return bool|WP_Error The passed in $return param or WP_Error.
 	 */
 	public function active_before( $return, $plugin ) {
 		if ( is_wp_error( $return ) ) {
@@ -466,11 +466,12 @@ class Plugin_Upgrader extends WP_Upgrader {
 
 		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
 
-		if ( ! is_plugin_active( $plugin ) ) { // If not active.
+		// Only run if plugin is active
+		if ( ! is_plugin_active( $plugin ) ) {
 			return $return;
 		}
 
-		// Bulk edit handles maintenance mode separately.
+		// Change to maintenance mode. Bulk edit handles this separately.
 		if ( ! $this->bulk ) {
 			$this->maintenance_mode( true );
 		}
@@ -485,9 +486,9 @@ class Plugin_Upgrader extends WP_Upgrader {
 	 *
 	 * @since 5.4.0
 	 *
-	 * @param bool|WP_Error  $return
-	 * @param array          $plugin
-	 * @return bool|WP_Error
+	 * @param bool|WP_Error  $return Upgrade offer return.
+	 * @param array          $plugin Plugin package arguments.
+	 * @return bool|WP_Error The passed in $return param or WP_Error.
 	 */
 	public function active_after( $return, $plugin ) {
 		if ( is_wp_error( $return ) ) {
@@ -501,11 +502,12 @@ class Plugin_Upgrader extends WP_Upgrader {
 
 		$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
 
-		if ( ! is_plugin_active( $plugin ) ) { // If not active.
+		// Only run if plugin is active
+		if ( ! is_plugin_active( $plugin ) ) {
 			return $return;
 		}
 
-		// Bulk edit handles maintenance mode separately.
+		// Time to remove maintenance mode. Bulk edit handles this separately.
 		if ( ! $this->bulk ) {
 			$this->maintenance_mode( false );
 		}
@@ -523,10 +525,10 @@ class Plugin_Upgrader extends WP_Upgrader {
 	 *
 	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
 	 *
-	 * @param bool|WP_Error $removed
-	 * @param string        $local_destination
-	 * @param string        $remote_destination
-	 * @param array         $plugin
+	 * @param bool|WP_Error $removed Whether the destination was cleared. true on success, WP_Error on failure.
+	 * @param string        $local_destination The local package destination.
+	 * @param string        $remote_destination The remote package destination.
+	 * @param array         $plugin Extra arguments passed to hooked filters.
 	 * @return bool|WP_Error
 	 */
 	public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) {
@@ -550,7 +552,7 @@ class Plugin_Upgrader extends WP_Upgrader {
 
 		// If plugin is in its own directory, recursively delete the directory.
 		// Base check on if plugin includes directory separator AND that it's not the root plugin folder.
-		if ( strpos( $plugin, '/' ) && $this_plugin_dir != $plugins_dir ) {
+		if ( strpos( $plugin, '/' ) && $this_plugin_dir !== $plugins_dir ) {
 			$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
 		} else {
 			$deleted = $wp_filesystem->delete( $plugins_dir . $plugin );
diff --git src/wp-admin/includes/class-theme-upgrader.php src/wp-admin/includes/class-theme-upgrader.php
index 261987401e..0d6c1f3538 100644
--- src/wp-admin/includes/class-theme-upgrader.php
+++ src/wp-admin/includes/class-theme-upgrader.php
@@ -528,9 +528,9 @@ class Theme_Upgrader extends WP_Upgrader {
 	 *
 	 * @since 2.8.0
 	 *
-	 * @param bool|WP_Error  $return
-	 * @param array          $theme
-	 * @return bool|WP_Error
+	 * @param bool|WP_Error  $return Upgrade offer return.
+	 * @param array          $theme Theme arguments.
+	 * @return bool|WP_Error The passed in $return param or WP_Error.
 	 */
 	public function current_before( $return, $theme ) {
 		if ( is_wp_error( $return ) ) {
@@ -539,11 +539,12 @@ class Theme_Upgrader extends WP_Upgrader {
 
 		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
 
-		if ( get_stylesheet() !== $theme ) { // If not current.
+		// Only run if current theme
+		if ( get_stylesheet() !== $theme ) {
 			return $return;
 		}
 
-		// Change to maintenance mode now.
+		// Change to maintenance mode. Bulk edit handles this separately.
 		if ( ! $this->bulk ) {
 			$this->maintenance_mode( true );
 		}
@@ -559,9 +560,9 @@ class Theme_Upgrader extends WP_Upgrader {
 	 *
 	 * @since 2.8.0
 	 *
-	 * @param bool|WP_Error  $return
-	 * @param array          $theme
-	 * @return bool|WP_Error
+	 * @param bool|WP_Error  $return Upgrade offer return.
+	 * @param array          $theme Theme arguments.
+	 * @return bool|WP_Error The passed in $return param or WP_Error.
 	 */
 	public function current_after( $return, $theme ) {
 		if ( is_wp_error( $return ) ) {
@@ -570,7 +571,8 @@ class Theme_Upgrader extends WP_Upgrader {
 
 		$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
 
-		if ( get_stylesheet() !== $theme ) { // If not current.
+		// Only run if current theme
+		if ( get_stylesheet() !== $theme ) {
 			return $return;
 		}
 
@@ -581,7 +583,7 @@ class Theme_Upgrader extends WP_Upgrader {
 			switch_theme( $stylesheet );
 		}
 
-		// Time to remove maintenance mode.
+		// Time to remove maintenance mode. Bulk edit handles this separately.
 		if ( ! $this->bulk ) {
 			$this->maintenance_mode( false );
 		}
