Skip to content

Commit 8e598b7

Browse files
authored
Initialize Scheduler before Migration to ensure hooks are registered (#2771)
1 parent 483b479 commit 8e598b7

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Fix migration activities not being scheduled for federation due to hook registration timing.

activitypub.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ function plugin_init() {
8585
\add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) );
8686
\add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) );
8787
\add_action( 'init', array( __NAMESPACE__ . '\Router', 'init' ) );
88-
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ) );
88+
// Priority 0 ensures Scheduler hooks are registered before Migration (priority 1) runs.
89+
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ), 0 );
8990
\add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) );
9091
\add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) );
9192

includes/class-scheduler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ public static function cleanup_remote_actors() {
274274
* Schedule the outbox item for federation.
275275
*
276276
* @param int $id The ID of the outbox item.
277-
* @param int $offset The offset to add to the scheduled time.
277+
* @param int $offset The offset to add to the scheduled time. Default 3 seconds.
278278
*/
279-
public static function schedule_outbox_activity_for_federation( $id, $offset = 0 ) {
279+
public static function schedule_outbox_activity_for_federation( $id, $offset = 3 ) {
280280
$hook = 'activitypub_process_outbox';
281281
$args = array( $id );
282282

0 commit comments

Comments
 (0)