Make WordPress Core

Changeset 57586


Ignore:
Timestamp:
02/12/2024 09:35:40 AM (10 months ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugins.php

    r57545 r57586  
    428428            $delete_result = delete_plugins( $plugins );
    429429
    430             // Store the result in a cache rather than a URL param due to object type & length.
    431             set_transient( 'plugins_delete_result_' . $user_ID, $delete_result );
     430            // Store the result in an option rather than a URL param due to object type & length.
     431            // Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete.
     432            update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false );
    432433            wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) );
    433434            exit;
     
    691692
    692693} elseif ( isset( $_GET['deleted'] ) ) {
    693     $delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
     694    $delete_result = get_option( 'plugins_delete_result_' . $user_ID );
    694695    // Delete it once we're done.
    695     delete_transient( 'plugins_delete_result_' . $user_ID );
     696    delete_option( 'plugins_delete_result_' . $user_ID );
    696697
    697698    if ( is_wp_error( $delete_result ) ) {
Note: See TracChangeset for help on using the changeset viewer.