From 72bc9c0b44a92ad1b657029b648055c0c0a1f601 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 12 Feb 2024 09:35:40 +0000 Subject: [PATCH] Plugins: Store plugin deletion results in temporary option. Storing the data in a non-autoloaded rather than a transient ensures it cannot be accidentally removed due to a cache flush. Props: kkmuffme, mukesh27. Fixes #59433. git-svn-id: https://develop.svn.wordpress.org/trunk@57586 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/plugins.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index f7514ab473..5c9f723283 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -427,8 +427,9 @@ if ( $action ) { $delete_result = delete_plugins( $plugins ); - // Store the result in a cache rather than a URL param due to object type & length. - set_transient( 'plugins_delete_result_' . $user_ID, $delete_result ); + // Store the result in an option rather than a URL param due to object type & length. + // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete. + update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false ); wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) ); exit; case 'clear-recent-list': @@ -690,9 +691,9 @@ if ( isset( $_GET['error'] ) ) { ); } elseif ( isset( $_GET['deleted'] ) ) { - $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); + $delete_result = get_option( 'plugins_delete_result_' . $user_ID ); // Delete it once we're done. - delete_transient( 'plugins_delete_result_' . $user_ID ); + delete_option( 'plugins_delete_result_' . $user_ID ); if ( is_wp_error( $delete_result ) ) { $plugin_not_deleted_message = sprintf(