20210617051913_issue_3618_google_calendar_url_https.rb 643 B

12345678910111213141516
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue3618GoogleCalendarUrlHttps < ActiveRecord::Migration[5.2]
  3. def change
  4. return if !Setting.exists?(name: 'system_init_done')
  5. Calendar
  6. .where('ical_url LIKE ?', 'http://www.google.com/calendar/ical/%')
  7. .each do |calendar|
  8. new_url = calendar.ical_url.sub(%r{^http://}, 'https://')
  9. # skipping validation allows to update old misconfigured calendar
  10. # https://github.com/zammad/zammad/issues/3641
  11. calendar.update_attribute :ical_url, new_url # rubocop:disable Rails/SkipsModelValidations
  12. end
  13. end
  14. end