mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Log deleted contacts to file, don't send poll message on initial cycle
This commit is contained in:
parent
ab1fa9064e
commit
7e9a3250bd
3 changed files with 17 additions and 4 deletions
|
@ -17,12 +17,13 @@ module Concerns
|
|||
inactive
|
||||
end
|
||||
|
||||
def archive(verified: false, notify: true)
|
||||
def archive(verified: false, notify: true, extra_log: false)
|
||||
unless verified
|
||||
raise 'Contact cannot be archived' unless archivable?(post: true)
|
||||
end
|
||||
|
||||
notify_registrar_about_archivation if notify
|
||||
write_to_registrar_log if extra_log
|
||||
destroy!
|
||||
end
|
||||
|
||||
|
@ -51,6 +52,17 @@ module Concerns
|
|||
@log ||= Logger.new(STDOUT)
|
||||
@log.info(msg)
|
||||
end
|
||||
|
||||
def write_to_registrar_log
|
||||
registrar_name = registrar.accounting_customer_code
|
||||
archive_path = ENV['contact_archivation_log_file_dir']
|
||||
registrar_log_path = "#{archive_path}/#{registrar_name}.txt"
|
||||
FileUtils.mkdir_p(archive_path) unless Dir.exist?(archive_path)
|
||||
|
||||
f = File.new(registrar_log_path, 'a+')
|
||||
f.write("#{code}\n")
|
||||
f.close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue