godaddy-wordpress / wc-plugin-framework

The official SkyVerge WooCommerce plugin framework
Other
138 stars 42 forks source link

Helper for uninstall scripts to delete all data brought by an extension #179

Open unfulvio opened 7 years ago

unfulvio commented 7 years ago

SkyVerge plugins so far do not feature an uninstall.php script. If this file is found in the plugin root, its code would be executed when a plugin is uninstalled from WordPress via WP Admin.

Generally our plugins don't leave a huge footprint, although we have some that leave behind setting options, or post types. With Memberships, that includes Action Scheduler, there are even comments. For Local Pickup Plus, we'll have a custom table. And so on.

It should be up to the customer decide whether wipe out all the data or just install the plugin and leave the data in db when uninstalling. Many plugins use the approach to include one option, like a checkbox, that, if ticked, when uninstalling the plugin all the data gets deleted, as a form of opt in.

We could framework such setting (use a standard option name like the one storing the plugin version) and a simple method to retrieve whether the option value is yes or no. Where to place this setting could be an individual plugin's burden, but we could also think of a helper to output the setting as long as it's a simple solution.

bekarice commented 7 years ago

not sure if we want to merge this into https://github.com/skyverge/wc-plugin-framework/issues/41

justinstern commented 7 years ago

good catch @bekarice it's the same issue