20220127135317_scheduler_updates2.rb 686 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class SchedulerUpdates2 < ActiveRecord::Migration[6.0]
  3. def change
  4. return if !Setting.exists?(name: 'system_init_done')
  5. schedulers_update = [
  6. {
  7. name: "Clean up 'Cti::Log'.",
  8. method: 'Cti::Log.cleanup',
  9. },
  10. ]
  11. schedulers_update.each do |scheduler|
  12. fetched_scheduler = Scheduler.find_by(method: scheduler[:method])
  13. next if !fetched_scheduler
  14. if scheduler[:name]
  15. # p "Updating name of #{scheduler[:name]} to #{scheduler[:name]}"
  16. fetched_scheduler.name = scheduler[:name]
  17. end
  18. fetched_scheduler.save!
  19. end
  20. end
  21. end