google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.22k stars 278 forks source link

Provide ability to delete all plugin data on uninstall #8988

Open aaemnnosttv opened 2 months ago

aaemnnosttv commented 2 months ago

Feature Description

Originally, Site Kit deleted all of its data when the plugin was uninstalled. While this seemed to be the proper approach, it resulted in more problems for users than it solved.

See

In https://github.com/google/site-kit-wp/issues/1069 we changed this behavior to no longer delete plugin data on uninstall, and allow users to do this via the "reset" functionality before uninstalling if desired.

Over time, we can see that this is not an ideal solution either as there are a number of options that are initialized as soon as the plugin is activated, or kept as persistent values. See also #6992.

One pattern that exists for solving this well is to provide an option in the plugin's settings to delete its data on uninstall. This way, the choice is still left to the user and Site Kit can perform a complete clean of its footprint on the DB when enabled at uninstall time.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

webd-uk commented 2 months ago

I have also commented on #6992 as I do not agree that issue should be closed in favour of this one.

As per WordPress WP Cron recommendations, tasks should be unscheduled when they are no-longer required and doing so on a deactivation hook (as recommended by WordPress) cannot have a detrimental effect because the plugin is no longer active!

Should the plugin be re-activated, the missing / required tasks will be added again by the plugin anyway.

This is not the same as deleting plugin data or options etc.