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
This commit is contained in:
Pascal Birchler
2024-02-12 09:35:40 +00:00
parent 6c5acc3463
commit 72bc9c0b44
+5 -4
View File
@@ -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(