[wp-trac] [WordPress Trac] #26904: General 'delete_plugins' hook needed
WordPress Trac
noreply at wordpress.org
Wed Jan 22 17:13:35 UTC 2014
#26904: General 'delete_plugins' hook needed
-----------------------------+------------------------------
Reporter: Veraxus | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.8
Severity: normal | Resolution:
Keywords: needs-patch |
-----------------------------+------------------------------
Comment (by Veraxus):
Replying to [comment:4 nacin]:
> That sounds more like plugin territory.
>
> Could you explain the "certain uninstall scenarios" that a hook in
uninstall_plugin() misses?
My first patch was inadequate as there are two scenarios handled by that
function...
1. Plugin has it's own uninstall file, run it.
2. Plugin has no uninstall file, run "uninstall_{$file}" hook instead.
By default, the first scenario has no hooks at all, and my first patch did
not add one... so I was unable to handle it at all. And without a patch,
the second scenario can't be handled either.
That means there are two viable options for adding the appropriate hooks
for "delete any plugin"...
1. A 'delete_plugins' hook that runs at the end of delete_plugins() (e.g.
delete_plugin_hook.diff) OR...
2. TWO separate hooks in uninstall_plugins(), one that handles custom
uninstalls, and then another that handles everything else.
I've tried both options and they both work well (I'll upload a fresh patch
momentarily that properly addresses point 2, as the original patch
neglects scenarios where a custom uninstall is run).
'delete_plugins' seems to address the need in the simplest way, but would
only be run ''after'' the files have been deleted (meaning you wouldn't be
able to pull metadata like name or author out of the plugin before
deletion occurs).
Honestly, I'd be fine with either solution, or both if there is a need.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26904#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list