Skip to content

Fix fatal error and stuck Pending migrations#610

Merged
akirk merged 2 commits intomainfrom
fix/migrations-mark-completed-when-nothing-to-do
Mar 26, 2026
Merged

Fix fatal error and stuck Pending migrations#610
akirk merged 2 commits intomainfrom
fix/migrations-mark-completed-when-nothing-to-do

Conversation

@akirk
Copy link
Copy Markdown
Owner

@akirk akirk commented Mar 25, 2026

Summary

  • Fatal error on activation (Error during installation process #611): Feed_Parser_ActivityPub is 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.
  • Migrations stuck in Pending: When clicking "Run" on a migration that has nothing to do, 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

  • Add class_exists check for Feed_Parser_ActivityPub to all migration methods that reference it
  • After run_migration() calls a method, mark it completed if the status option is still unset

Fixes #611

Test plan

  • Activate plugin without ActivityPub plugin installed — no fatal error
  • Click "Run" on migrations with nothing to do — they show as Completed

Test in WordPress Playground

akirk added 2 commits March 25, 2026 13:17
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
@akirk akirk changed the title Fix migrations stuck in Pending when nothing to migrate Fix fatal error and stuck Pending migrations Mar 26, 2026
@akirk akirk merged commit 202c477 into main Mar 26, 2026
25 checks passed
@akirk akirk deleted the fix/migrations-mark-completed-when-nothing-to-do branch March 26, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error during installation process

1 participant