0 && null === Jobs::find_pending( 'retention' ) ) { Jobs::enqueue( 'retention' ); } Jobs::run(); Jobs::purge(); } /** * Job handler: deletes entries past the retention period in bounded * batches, and queues itself again while older entries remain. */ public static function retention_job(): bool { $days = (int) Settings::get( 'retention_days' ); if ( $days <= 0 ) { return true; } for ( $i = 0; $i < 5; $i++ ) { $ids = Entry_Store::ids_older_than( $days, 200 ); if ( array() === $ids ) { return true; } Entry_Store::delete( $ids ); } if ( array() !== Entry_Store::ids_older_than( $days, 1 ) ) { Jobs::enqueue( 'retention' ); } return true; } }