wc-plugin-framework icon indicating copy to clipboard operation
wc-plugin-framework copied to clipboard

Add uninstall routine

Open ragulka opened this issue 11 years ago • 6 comments

Do we need to handle plugin uninstalls somehow? Consider the following scnario:

  1. User installs plugin version 1.0
  2. After a while, she uninstalls it
  3. After a little while more, she installs the same plugin, version 1.2

It's important that all the install and upgrade routines are run correct each time. I'm not sure if the current implementation can lead to issues there, but let's discuss any possible shortcomings.

ragulka avatar May 13 '14 16:05 ragulka

My feeling has always been that I never want to delete data out from under merchants, without their explicit knowledge/acceptance. Which is why we leave data around upon uninstall (which sometimes happens when merchant is temporarily uninstalling in order to do a manual plugin update, since the WooThemes updater is oh so reliable).

The framework makes it relatively straightforward to write safe migrations, see an example with mollie

However, I definitely would not be opposed to adding a "delete all data" uninstallation option that the merchant would explicitly enable/use.

justinstern avatar May 13 '14 17:05 justinstern

Thinking about this, I just wonder where the "delete" option would go? WP doesn't exactly lend itself to this sort of thing very well. The only thing I can think of is the plugin action links, but we already have so many of those as it is.

On that note, maybe we should consider pulling the "Write a Review" action link, considering how many people make use of that. @maxrice ?

justinstern avatar Aug 31 '14 04:08 justinstern

Yeah the write a review link doesn't seem to be too popular, probably because most people don't visit the plugins page that often. An "uninstall" plugin action link that sets an option, renders a notice, and deactivates the plugin would be a nice flow.

maxrice avatar Sep 01 '14 20:09 maxrice

related #179

unfulvio avatar Nov 17 '16 08:11 unfulvio

I thought i had already added this in GitHub but apparently not. A nice way to handle uninstalls is to add a section/button under System Status > Tools so that deleting data from a plugin is a hard-to-find discrete action a merchant has to take. This goes in line with @unfulvio's note in #179 to make this a choice the merchant makes.

IMO, this is by far a better way to handle WP plugin uninstalls than uninstall.php even when using an option. Many plugins of ours don't have an options page or only have one or 2 strategically placed options that adding one for deleting data on uninstall is a bit silly (see Cart Notices which adds an entire WC settings section for Cart Notices just for this one option).

edited: I keep confusing Nested Category Layout with Cart Notices 😆 , updated my note to cite the correct plugin

tamarazuk avatar Nov 17 '16 17:11 tamarazuk

Many plugins of ours don't have an options page or only have one or 2 strategically placed options that adding one for deleting data on uninstall is a bit silly

Yep, agreed. I think your suggestion for adding a System Status tool is spot on.

ChaseWiseman avatar Nov 18 '16 17:11 ChaseWiseman