Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#26065 closed defect (bug) (fixed)

update_plugins transient not properly updated when multiple plugins are deleted

Reported by: jdgrimes's profile jdgrimes Owned by: dd32's profile dd32
Milestone: 3.8 Priority: normal
Severity: normal Version: 2.8
Component: Plugins Keywords: has-patch commit
Focuses: Cc:

Description

In delete_plugins(), the update_plugins transient is updated, but only the last plugin deleted is removed. Abridged code:

foreach ( $plugins as $plugin_file ) {
    /* ... */
}

if ( $current = get_site_transient('update_plugins') ) {
    unset( $current->response[ $plugin_file ] );
    set_site_transient('update_plugins', $current);
}

The unset() should be performed for each deleted plugin. Patch forthcoming.

Attachments (1)

26065.diff (1.0 KB) - added by jdgrimes 10 years ago.

Download all attachments as: .zip

Change History (8)

@jdgrimes
10 years ago

#1 @jdgrimes
10 years ago

For reference, this was introduced in [11207].

#2 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 3.8

#3 @dd32
10 years ago

  • Keywords commit added

This looks good to me, untested though.

#4 @dd32
10 years ago

tested

#5 @dd32
10 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 26262:

Plugin Deletion: Properly clear the cache when multiple plugins are deleted. Props jdgrimes. Fixes #26065

#6 @nacin
10 years ago

This seems like a lot of work — would it be easier to just wipe the entire transient with wp_clean_plugins_cache()? That'll also wipe the get_plugins() cache, which probably couldn't hurt.

#7 @dd32
10 years ago

I was tempted to just refresh the update transient at that point too, but that'd have just introduced yet another case where updates disappear for a pageload after we do something for no good reason (when we already had code to work around it).

Could've also just issued an update check at that point (which would notice the plugins installed had changed), but that'd be another potential HTTP timeout after deletion.

Note: See TracTickets for help on using tickets.