purge_older_than_days( $retention_days ); } /** * Clear schedule. * * @return void */ private static function clear_scheduled(): void { if ( self::is_action_scheduler_available() ) { if ( function_exists( 'as_unschedule_all_actions' ) ) { as_unschedule_all_actions( Constants::HOOK_NOTIFY_DAILY_DIGEST, array(), self::ACTION_GROUP ); as_unschedule_all_actions( Constants::HOOK_NOTIFY_LOG_CLEANUP, array(), self::ACTION_GROUP ); } } } /** * Whether Action Scheduler is available. * * @return bool */ private static function is_action_scheduler_available(): bool { return function_exists( 'as_schedule_recurring_action' ) && function_exists( 'as_next_scheduled_action' ); } }