123456789101112131415161718192021 |
- # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
- class RelocateUnprocessableMails < ActiveRecord::Migration[6.1]
- def change
- # return if it's a new setup
- return if !Setting.exists?(name: 'system_init_done')
- relocate_files('unprocessable_mail')
- relocate_files('oversized_mail')
- end
- def relocate_files(type)
- old_dir = Rails.root.join('tmp', type)
- return if !old_dir.exist? || old_dir.children.empty?
- new_dir = Rails.root.join('var/spool', type)
- FileUtils.mkdir_p(new_dir)
- FileUtils.cp_r(old_dir.children, new_dir)
- FileUtils.rm_r(old_dir)
- end
- end
|