Make WordPress Core

Opened 8 years ago

Closed 7 weeks ago

#36704 closed defect (bug) (duplicate)

Delete Plugin not compatible with Bulk Actions

Reported by: andy's profile andy Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Plugins Keywords:
Focuses: administration Cc:


delete_plugins() has a foreach loop which calls uninstall_plugin() which defines a constant:

define('WP_UNINSTALL_PLUGIN', $file);

A constant cannot be defined twice. If several plugins are selected for bulk deletion and two of these have uninstall.php, only the first one will see the expected constant value. For example, Jetpack's uninstall.php dies immediately when the constant contains an unexpected value. This prevents the code at the end of delete_plugins() finishing the job for the plugins that were uninstalled and deleted. (Jetpack's uninstall.php isn't exactly doing it right, but it's a very real example.)

The obvious fix is to remove Delete from bulk actions on the Plugins page. This leaves the working parts in working order and buys time to rewrite the delete/uninstall API to work with a bulk delete function if this is desirable.

Part of the rework would involve rewriting uninstall_plugin() and the uninstall.php pattern so that it can return a WP_Error instead of dying. This way, delete_plugins() could continue without leaving the work of delete_plugins() incomplete for the plugins that were uninstalled.

I propose removing Delete from bulk plugin actions until the uninstall API is made compatible with bulk deletion.

Attachments (1)

36704-no-bulk-delete.diff (623 bytes) - added by andy 8 years ago.
Remove delete from plugin bulk actions

Download all attachments as: .zip

Change History (3)

8 years ago

Remove delete from plugin bulk actions

#1 @jdgrimes
8 years ago

Related: #26735

#2 @kkmuffme
7 weeks ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #26735.

Note: See TracTickets for help on using tickets.