From dca58d725ea1c89bb925278cff55dcc94da61daa Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Fri, 5 Apr 2019 15:32:31 +0000 Subject: [PATCH] Bootstrap/Load: Remove extension from the list of paused extensions when it is deactivated. With this change, fatal errors recorded before a plugin was deactivated or a theme was switched away from do not persist. This ensures that re-enabling it re-checks for fatal errors correctly. Props aandrewdixon, dhanukanuwan, henrywright. Fixes #46812. git-svn-id: https://develop.svn.wordpress.org/trunk@45115 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/plugin.php | 5 +++++ src/wp-includes/theme.php | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index 2716bd4fef..f8ca6ea5fd 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -768,6 +768,11 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) { } } + if ( $do_blog && wp_is_recovery_mode() ) { + list( $extension ) = explode( '/', $plugin ); + wp_paused_plugins()->delete( $extension ); + } + if ( ! $silent ) { /** * Fires as a specific plugin is being deactivated. diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index e688cc66fa..eb960f8004 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -744,6 +744,12 @@ function switch_theme( $stylesheet ) { $new_theme = wp_get_theme( $stylesheet ); $template = $new_theme->get_template(); + if ( wp_is_recovery_mode() ) { + $paused_themes = wp_paused_themes(); + $paused_themes->delete( $old_theme->get_stylesheet() ); + $paused_themes->delete( $old_theme->get_template() ); + } + update_option( 'template', $template ); update_option( 'stylesheet', $stylesheet );