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

Clean up options and meta on uninstall #1134

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* Added a filter to make custom comment types manageable in WP.com Calypso
* Cleanup of options, post meta, and user meta when the plugin is uninstalled

### Changed

Expand Down
42 changes: 41 additions & 1 deletion includes/class-activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function init() {
\add_filter( 'pre_get_avatar_data', array( self::class, 'pre_get_avatar_data' ), 11, 2 );

// Add support for ActivityPub to custom post types.
$post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post' ) ) : array();
$post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) );

foreach ( $post_types as $post_type ) {
\add_post_type_support( $post_type, 'activitypub' );
Expand Down Expand Up @@ -77,6 +77,46 @@ public static function deactivate() {
*/
public static function uninstall() {
Scheduler::deregister_schedules();

delete_metadata( 'user', 0, '_activitypub_user_identifier', '', true );
obenland marked this conversation as resolved.
Show resolved Hide resolved
delete_metadata( 'user', 0, 'activitypub_default_extra_fields', '', true );
delete_metadata( 'user', 0, 'activitypub_followers', '', true );
delete_metadata( 'user', 0, 'magic_sig_public_key', '', true );
delete_metadata( 'user', 0, 'magic_sig_private_key', '', true );

delete_metadata( 'post', 0, '_activitypub_actor_json', '', true );
delete_metadata( 'post', 0, '_activitypub_canonical_url', '', true );
delete_metadata( 'post', 0, '_activitypub_errors', '', true );
delete_metadata( 'post', 0, '_activitypub_inbox', '', true );
delete_metadata( 'post', 0, '_activitypub_user_id', '', true );
delete_metadata( 'post', 0, 'activitypub_content_warning', '', true );
delete_metadata( 'post', 0, 'activitypub_content_visibility', '', true );

delete_option( 'activitypub_actor_mode' );
delete_option( 'activitypub_attribution_domains' );
delete_option( 'activitypub_authorized_fetch' );
delete_option( 'activitypub_application_user_private_key' );
delete_option( 'activitypub_application_user_public_key' );
delete_option( 'activitypub_blog_user_private_key' );
delete_option( 'activitypub_blog_user_public_key' );
delete_option( 'activitypub_blog_description' );
delete_option( 'activitypub_blog_identifier' );
delete_option( 'activitypub_custom_post_content' );
delete_option( 'activitypub_db_version' );
delete_option( 'activitypub_default_extra_fields' );
delete_option( 'activitypub_enable_blog_user' );
delete_option( 'activitypub_enable_users' );
delete_option( 'activitypub_header_image' );
delete_option( 'activitypub_last_post_with_permalink_as_id' );
delete_option( 'activitypub_mailer_new_follower' );
delete_option( 'activitypub_mailer_new_dm' );
delete_option( 'activitypub_max_image_attachments' );
delete_option( 'activitypub_migration_lock' );
delete_option( 'activitypub_object_type' );
delete_option( 'activitypub_support_post_types' );
delete_option( 'activitypub_use_hashtags' );
delete_option( 'activitypub_use_opengraph' );
delete_option( 'activitypub_use_permalink_as_id_for_blog' );
}

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ For reasons of data protection, it is not possible to see the followers of other
= Unreleased =

* Added: A filter to make custom comment types manageable in WP.com Calypso
* Added: Cleanup of options, post meta, and user meta when the plugin is uninstalled
* Changed: Hide ActivityPub post meta keys from the custom Fields UI
* Fixed: Undefined array key warnings in various places
* Fixed: Fetching replies from the same instance for Enable Mastodon Apps
Expand Down
Loading