Fix fatal error and stuck Pending migrations#610
Merged
Conversation
When a migration has nothing to do (no matching posts, or required plugin not active), clicking Run via the UI calls run_migration which resets the status option, then calls the migration method. If the method returns early with nothing to do, the status option stays unset and the migration is stuck in Pending forever. After run_migration calls the method, check if the status option is still unset and mark the migration as completed if so. This handles all cases centrally without modifying individual migration methods.
Feed_Parser_ActivityPub is only loaded when the ActivityPub plugin is active, but several migration methods only checked for ActivityPub plugin classes (Remote_Actors, Following) before referencing it. This caused a fatal error during plugin activation when ActivityPub was previously installed but now disabled. Add class_exists check for Feed_Parser_ActivityPub to all migration methods that reference it: import_activitypub_followings, migrate_activitypub_attributed_to, link_activitypub_feeds_to_actors, and backfill_external_attributed_to. Also fix migrations stuck in Pending when run via the UI by marking them completed in run_migration() when the method returns without setting the status option. Fixes #611
This was referenced Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Feed_Parser_ActivityPubis only loaded when the ActivityPub plugin is active, but migration methods only checked for ActivityPub plugin classes (Remote_Actors,Following) before referencing it. This caused a fatal error during activation when ActivityPub was previously installed but now disabled.run_migration()resets the status option, calls the method, but the method returns early without setting it back — leaving it stuck in "Pending" forever.Changes
class_existscheck forFeed_Parser_ActivityPubto all migration methods that reference itrun_migration()calls a method, mark it completed if the status option is still unsetFixes #611
Test plan
Test in WordPress Playground