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. diff --git a/activitypub.php b/activitypub.php index 131d6784bc..45cd1d4114 100644 --- a/activitypub.php +++ b/activitypub.php @@ -85,7 +85,8 @@ 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' ) ); + // 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' ) ); diff --git a/includes/class-scheduler.php b/includes/class-scheduler.php index 19ea1ba22b..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. + * @param int $offset The offset to add to the scheduled time. Default 3 seconds. */ - public static function schedule_outbox_activity_for_federation( $id, $offset = 0 ) { + public static function schedule_outbox_activity_for_federation( $id, $offset = 3 ) { $hook = 'activitypub_process_outbox'; $args = array( $id );