20170314000001_fixed_translation2.rb 820 B

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class FixedTranslation2 < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. settings_update = [
  7. {
  8. 'name' => 'http_type',
  9. 'title' => 'HTTP type',
  10. 'description' => 'Define the http protocol of your instance.',
  11. },
  12. ]
  13. settings_update.each do |setting|
  14. fetched_setting = Setting.find_by(name: setting['name'])
  15. next if !fetched_setting
  16. if setting['title']
  17. fetched_setting.title = setting['title']
  18. end
  19. if setting['description']
  20. fetched_setting.description = setting['description']
  21. end
  22. fetched_setting.save!
  23. end
  24. Translation.sync
  25. end
  26. end