From 2f1785318dd7c4ec38ba666568bc0175f220579c Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 15 Jan 2026 11:32:09 +0100 Subject: [PATCH 1/5] Initialize Scheduler before Migration to ensure hooks are registered. Changed Scheduler::init() priority from 10 (default) to 0, so it runs before Migration::init() (priority 1). This ensures that the post_activitypub_add_to_outbox hooks are registered before any migration code calls add_to_outbox(), allowing activities to be properly scheduled for federation. --- activitypub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activitypub.php b/activitypub.php index 131d6784bc..db79372fc9 100644 --- a/activitypub.php +++ b/activitypub.php @@ -85,7 +85,7 @@ function plugin_init() { \add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Router', 'init' ) ); - \add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ) ); + \add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ), 0 ); \add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) ); From a5ce6db944f93896a37b7ca85d4c9c1d4029b2a1 Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Thu, 15 Jan 2026 11:45:41 +0100 Subject: [PATCH 2/5] Add changelog --- .github/changelog/2771-from-description | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/changelog/2771-from-description diff --git a/.github/changelog/2771-from-description b/.github/changelog/2771-from-description new file mode 100644 index 0000000000..c93463f2f5 --- /dev/null +++ b/.github/changelog/2771-from-description @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix migration activities not being scheduled for federation due to hook registration timing. From 72338aae1a6ad1f737b2588b87cfcea6f18f80d2 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 15 Jan 2026 12:18:55 +0100 Subject: [PATCH 3/5] Set default offset to 5 seconds in schedule method Updated the schedule_outbox_activity_for_federation method to use a default offset of 5 seconds instead of 0. This change ensures outbox items are scheduled with a slight delay by default. --- includes/class-scheduler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-scheduler.php b/includes/class-scheduler.php index 19ea1ba22b..b9a95daee0 100644 --- a/includes/class-scheduler.php +++ b/includes/class-scheduler.php @@ -274,9 +274,9 @@ public static function cleanup_remote_actors() { * Schedule the outbox item for federation. * * @param int $id The ID of the outbox item. - * @param int $offset The offset to add to the scheduled time. + * @param int $offset The offset to add to the scheduled time. Default 5 seconds. */ - public static function schedule_outbox_activity_for_federation( $id, $offset = 0 ) { + public static function schedule_outbox_activity_for_federation( $id, $offset = 5 ) { $hook = 'activitypub_process_outbox'; $args = array( $id ); From 0b4f2fb4789a0072ae491d990f0fb875beb82c1b Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 15 Jan 2026 12:19:25 +0100 Subject: [PATCH 4/5] Change default offset for outbox scheduling to 3 seconds Updated the default offset parameter in schedule_outbox_activity_for_federation from 5 seconds to 3 seconds to adjust the scheduling timing for outbox items. --- includes/class-scheduler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-scheduler.php b/includes/class-scheduler.php index b9a95daee0..1853fffe5a 100644 --- a/includes/class-scheduler.php +++ b/includes/class-scheduler.php @@ -274,9 +274,9 @@ public static function cleanup_remote_actors() { * Schedule the outbox item for federation. * * @param int $id The ID of the outbox item. - * @param int $offset The offset to add to the scheduled time. Default 5 seconds. + * @param int $offset The offset to add to the scheduled time. Default 3 seconds. */ - public static function schedule_outbox_activity_for_federation( $id, $offset = 5 ) { + public static function schedule_outbox_activity_for_federation( $id, $offset = 3 ) { $hook = 'activitypub_process_outbox'; $args = array( $id ); From f669d771d74b99f430354f324aa2baad4010fca7 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 16 Jan 2026 11:51:10 +0100 Subject: [PATCH 5/5] Add comment explaining Scheduler priority. --- activitypub.php | 1 + 1 file changed, 1 insertion(+) diff --git a/activitypub.php b/activitypub.php index db79372fc9..45cd1d4114 100644 --- a/activitypub.php +++ b/activitypub.php @@ -85,6 +85,7 @@ function plugin_init() { \add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Router', 'init' ) ); + // Priority 0 ensures Scheduler hooks are registered before Migration (priority 1) runs. \add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ), 0 ); \add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) ); \add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) );