only schedule migration if DB is not on the latest version
This commit is contained in:
parent
c04cf3fc7e
commit
084f108161
1 changed files with 13 additions and 0 deletions
|
@ -19,6 +19,8 @@ class Scheduler {
|
|||
|
||||
\add_action( 'activitypub_update_followers', array( self::class, 'update_followers' ) );
|
||||
\add_action( 'activitypub_cleanup_followers', array( self::class, 'cleanup_followers' ) );
|
||||
|
||||
\add_action( 'admin_init', array( self::class, 'schedule_migration' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,4 +137,15 @@ class Scheduler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule migration if DB-Version is not up to date.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function schedule_migration() {
|
||||
if ( ! \wp_next_scheduled( 'activitypub_schedule_migration' ) && ! Migration::is_latest_version() ) {
|
||||
\wp_schedule_single_event( \time(), 'activitypub_schedule_migration' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue