-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Uninstall distributor #540
base: develop
Are you sure you want to change the base?
Conversation
Moving this to |
@peterwilsoncc, Can you provide a list of data we should remove when someone installs a plugin? |
@peterwilsoncc Distributor supports multisite. In this case, the Super Admin can only delete the plugin. I think we should clear distributor plugin data from subsites, what does this think? cc: @jeffpaul |
@ravinderk so you're asking about the case where distributor is network installed and network activated (different from the case where it's installed or activated on individual sites for a use case where someone only wants distributor to work on parts of a multi site)? |
@jeffpaul You are correct. |
I'm not quite wildly in favor of deleting Distributor syndication mapping post meta when someone deactivates the plugin, though I suppose if someone actually uninstalls (again, specifically considering this differently from deactivating) it's probably fine to clear Distributor data. The downside is someone who then wants to re-install and activate Distributor that all previous syndication mappings would be gone and make things super difficult to get synchronized again, but that would fall into a @ravinderk want to work on iterating on the PR here to properly remove Distributor data when someone uninstalls the plugin (again, NOT when its merely deactivated but ONLY when it's uninstalled)? |
@jeffpaul I implemented logic to remove distributor data from the database only if:
I also recommend showing the modal when uninstalling the distributor plugin to inform the admin.
Removing distributor data from each subsite can be very resource-intensive. I think we should not do it and inform the admin about this when uninstalling the plugin |
I concur on both points. |
@jeffpaul I implemented the deactivation modal. cc: @peterwilsoncc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a few notes inline
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend | ||
* and to ensure only the site owner can perform this action. | ||
*/ | ||
if ( defined( 'DT_REMOVE_ALL_DATA' ) && true === DT_REMOVE_ALL_DATA ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only remove the data from the current site (the network base site on the network tab) but the data will remain on sub-sites.
It might be possible to loop through the sites on small networks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterwilsoncc, after discussing with @jeffpaul, we decided to take care of the main website. It will be helpful for users to be aware of this.
@jeffpaul Do you have thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that so long as we've presented the admin uninstalling Distributor with an "are you sure" sort of message on the impacts of fully removing Distributor data, then we should look for a reliable and performant, if slow and long-running, approach to clearing that data across all sites on a network.
Co-authored-by: Peter Wilson <[email protected]>
Let's follow what WP.org recommends/requires: https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/ |
@10up/open-source-practice another PR that would be good to look into getting wrapped up and ready for release |
Description of the Change
uninstall.php
script to delete distributor data in the database.DT_REMOVE_ALL_DATA
constant to prevent accidental data deletion.A modal will display when deactivating the plugin. This modal does not display in sub-sites.
Benefits
Delete distributor data on uninstalling.
Possible Drawbacks
n/a
Verification Process
Check the database manually.
Checklist:
Applicable Issues
Closes #349
Changelog Entry