GatherPress / gatherpress

Powering our community's event management needs.
GNU General Public License v2.0
64 stars 23 forks source link

Add uninstall.php or uninstall routine #681

Open carstingaxion opened 4 weeks ago

carstingaxion commented 4 weeks ago

Is your enhancement related to a problem? Please describe.

Not that I want anybody to uninstall GatherPress, but people should be able to do that without any worries.

Following WordPress best-practices for uninstallation, GatherPress should have something like this somewhere.

// if uninstall.php is not called by WordPress, die
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    die;
}

$option_name = 'wporg_option';

delete_option( $option_name );

// for site options in Multisite
delete_site_option( $option_name );

// drop a custom database table
global $wpdb;
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}mytable" );

In Multisite, looping through all blogs to delete options can be very resource intensive.

Designs

Shouldn't be to much effort, if the existing & related methods can be re-used and we don't forget about the transients in #680

https://github.com/GatherPress/gatherpress/blob/4942ce87071662cddcb8c993ae42893cad303830/includes/core/classes/class-setup.php#L196-L198

and

https://github.com/GatherPress/gatherpress/blob/4942ce87071662cddcb8c993ae42893cad303830/includes/core/classes/class-setup.php#L307-L314

Describe alternatives you've considered

No response

Code of Conduct

MervinHernandez commented 3 weeks ago

✅ Viewed 681 - Uninstall workflows - Caleb has it

MervinHernandez commented 2 weeks ago

Hi @bluecollarcoders where do we stand on drafting an uninstall workflow?

bluecollarcoders commented 1 week ago

Hi @MervinHernandez

I started work on the ticket. I apologize for the late response.