[wp-trac] [WordPress Trac] #43098: Defining WP_UNINSTALL_PLUGIN also when the uninstall handler is registered via register_uninstall_hook()

WordPress Trac noreply at wordpress.org
Tue Jan 16 14:18:37 UTC 2018


#43098: Defining WP_UNINSTALL_PLUGIN also when the uninstall handler is registered
via register_uninstall_hook()
----------------------------+-----------------------------
 Reporter:  svovaf          |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 At the moment, there's no way to "know" that the context execution is
 uninstallation until the uninstall hook is executed:
 {{{
 do_action( "uninstall_{$file}" );
 }}}

 I'd like to move the definition of `WP_UNINSTALL_PLUGIN` to be set for
 both uninstall handlers (the `uninstall.php` and the
 `register_uninstall_hook()` hook).

 The fix is super simple, just moving `define('WP_UNINSTALL_PLUGIN',
 $file);` in `/wp-admin/includes/plugin.php` outside the `if` statement.

 It's needed when a plugin need to execute some code prior to the
 `register_uninstall_hook()` execution that is later used within the
 callback.

 I couldn't think of any intentional reason why it shouldn't be defined for
 both uninstallation methods.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43098>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list