Skip to content
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

Add uninstall.php or uninstall routine #681

Open
1 task done
carstingaxion opened this issue Jun 9, 2024 · 6 comments · May be fixed by #716
Open
1 task done

Add uninstall.php or uninstall routine #681

carstingaxion opened this issue Jun 9, 2024 · 6 comments · May be fixed by #716
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@carstingaxion
Copy link
Collaborator

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

public function deactivate_gatherpress_plugin(): void {
flush_rewrite_rules();
}

and

public function on_site_delete( array $tables ): array {
global $wpdb;
$tables[] = sprintf( Event::TABLE_FORMAT, $wpdb->prefix, Event::POST_TYPE );
$tables[] = sprintf( Rsvp::TABLE_FORMAT, $wpdb->prefix );
return $tables;
}

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@carstingaxion carstingaxion added the enhancement New feature or request label Jun 9, 2024
@carstingaxion carstingaxion added this to the 0.30.0 milestone Jun 13, 2024
@MervinHernandez
Copy link
Collaborator

✅ Viewed 681 - Uninstall workflows - Caleb has it

@MervinHernandez
Copy link
Collaborator

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

@bluecollarcoders
Copy link
Collaborator

Hi @MervinHernandez

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

@mauteri
Copy link
Contributor

mauteri commented Jul 14, 2024

It would be good to list all the data that needs to be removed, so @bluecollarcoders knows what the scope is. I'll look to get a list of everything some time this week and post it to the ticket. Thx!

@mauteri mauteri modified the milestones: 0.30.0, 0.31.0 Jul 20, 2024
@carstingaxion carstingaxion linked a pull request Aug 28, 2024 that will close this issue
4 tasks
@carstingaxion carstingaxion added the good first issue Good for newcomers label Aug 28, 2024
@MervinHernandez
Copy link
Collaborator

#wcus_2024
@mauteri have we discussed - uninstall should yank settings only or should it also yank data?

@MervinHernandez
Copy link
Collaborator

✅ Answer = yank settings + data + custom tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Next Release
Development

Successfully merging a pull request may close this issue.

4 participants