[wp-trac] [WordPress Trac] #50346: Make delete plugin message less scary

WordPress Trac noreply at wordpress.org
Mon Jul 13 14:07:26 UTC 2020


#50346: Make delete plugin message less scary
-------------------------------------+-----------------------------
 Reporter:  joostdevalk              |       Owner:  SergeyBiryukov
     Type:  defect (bug)             |      Status:  closed
 Priority:  normal                   |   Milestone:  5.5
Component:  Plugins                  |     Version:
 Severity:  normal                   |  Resolution:  fixed
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:8 SergeyBiryukov]:
 > Replying to [comment:6 samful]:
 > > How would you feel about adding "If the plugin has data, this will not
 be deleted." to the second option? As some uninstallable plugins won't
 actually have data, am I right?
 >
 > Wanted to go with this, but it sounds like the plugin itself won't be
 deleted if it has any data.
 >
 > Let's just go with "Are you sure you want to delete %s?" for the initial
 iteration and see if any further adjustments to the message could be made.

 Thinking about this some more, `is_uninstallable_plugin()` only checks
 for:
 * Whether the plugin has an uninstall hook added via
 `register_uninstall_hook()`.
 * Whether the plugin has an `uninstall.php` file.

 It does not, however, check whether the plugin has a deactivation hook
 added via `register_deactivation_hook()`.

 As noted in the [https://developer.wordpress.org/plugins/plugin-basics
 /activation-deactivation-hooks/ plugin handbook], deleting the plugin data
 on the deactivation hook is not recommended. However, it could technically
 still be done, in which case saying the data won't be deleted would be a
 promise we can't keep, as that statement would not be accurate.

 Something like an additional check for `has_action(
 'deactivate_{$plugin_file}' )` might work, but may not account for any
 edge cases if the file used for `register_deactivation_hook()` is not the
 same as the main plugin file.

 So [48451] seems good enough for now.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50346#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list