[wp-trac] [WordPress Trac] #36704: Delete Plugin not compatible with Bulk Actions
WordPress Trac
noreply at wordpress.org
Thu Apr 28 19:56:40 UTC 2016
#36704: Delete Plugin not compatible with Bulk Actions
----------------------------+-----------------------------
Reporter: andy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 4.5.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
`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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36704>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list