Skip to content

Commit

Permalink
unschedule old hooks
Browse files Browse the repository at this point in the history
related #639
  • Loading branch information
pfefferle committed Jan 13, 2024
1 parent d684261 commit b2271cd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions includes/class-migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public static function maybe_migrate() {
if ( version_compare( $version_from_db, '1.3.0', '<' ) ) {
self::migrate_from_1_2_0();
}
if ( version_compare( $version_from_db, '2.1.0', '<' ) ) {
self::migrate_from_2_0_0();
}

update_option( 'activitypub_db_version', self::get_target_version() );

Expand Down Expand Up @@ -197,4 +200,19 @@ private static function migrate_from_1_2_0() {
wp_cache_delete( sprintf( Followers::CACHE_KEY_INBOXES, $user_id ), 'activitypub' );
}
}

/**
* Unschedule Hooks after updating to 2.0.0
*
* @return void
*/
private static function migrate_from_2_0_0() {
wp_clear_scheduled_hook( 'activitypub_send_post_activity' );
wp_clear_scheduled_hook( 'activitypub_send_update_activity' );
wp_clear_scheduled_hook( 'activitypub_send_delete_activity' );

wp_unschedule_hook( 'activitypub_send_post_activity' );
wp_unschedule_hook( 'activitypub_send_update_activity' );
wp_unschedule_hook( 'activitypub_send_delete_activity' );
}
}

0 comments on commit b2271cd

Please sign in to comment.