Opened 8 years ago
Closed 5 months ago
#36704 closed defect (bug) (duplicate)
Delete Plugin not compatible with Bulk Actions
Reported by: | andy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.1 |
Component: | Plugins | Keywords: | |
Focuses: | administration | Cc: |
Description
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.
Remove delete from plugin bulk actions