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

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

Open unfulvio opened this issue 9 years ago • 2 comments
trafficstars

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.

unfulvio avatar Nov 17 '16 07:11 unfulvio

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

bekarice avatar Nov 17 '16 08:11 bekarice

good catch @bekarice it's the same issue

justinstern avatar Nov 17 '16 15:11 justinstern