imap_authentication_migration_cleanup_job.rb 538 B

12345678910111213141516
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class ImapAuthenticationMigrationCleanupJob < ApplicationJob
  3. include HasActiveJobLock
  4. def perform
  5. Channel.where(area: ['Google::Account', 'Microsoft365::Account']).find_each do |channel|
  6. next if channel.options.blank?
  7. next if channel.options[:backup_imap_classic].blank?
  8. next if channel.options[:backup_imap_classic][:migrated_at] > 7.days.ago
  9. channel.options.delete(:backup_imap_classic)
  10. channel.save!
  11. end
  12. end
  13. end