20220216131241_issue3964_inbound_fix_options.rb 767 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue3964InboundFixOptions < ActiveRecord::Migration[6.0]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Channel.where(area: ['Email::Account', 'Google::Account', 'Microsoft365::Account']).find_each do |channel|
  7. ssl = channel.options.dig(:inbound, :options, :ssl)
  8. next if ssl.nil?
  9. channel.options[:inbound][:options][:ssl] = if ssl == true
  10. 'ssl'
  11. else
  12. 'off'
  13. end
  14. channel.save!
  15. end
  16. end
  17. end