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.
Built from https://develop.svn.wordpress.org/trunk@57586


git-svn-id: http://core.svn.wordpress.org/trunk@57087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2024-02-12 09:37:08 +00:00
parent 42abc00010
commit cb4b56dfda
2 changed files with 6 additions and 5 deletions

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(

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-alpha-57585';
$wp_version = '6.5-alpha-57586';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.