mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
115693873-log_changes
This commit is contained in:
parent
248a04f63a
commit
24aec79ceb
5 changed files with 7 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
class DomainDeleteConfirmJob < Que::Job
|
class DomainDeleteConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
@ -13,7 +14,6 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||||
domain.cancel_pending_delete
|
domain.cancel_pending_delete
|
||||||
end
|
end
|
||||||
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class DomainUpdateConfirmJob < Que::Job
|
class DomainUpdateConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
@ -14,7 +15,6 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||||
domain.clean_pendings_lowlevel
|
domain.clean_pendings_lowlevel
|
||||||
end
|
end
|
||||||
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class UpdateWhoisRecordJob < Que::Job
|
class UpdateWhoisRecordJob < Que::Job
|
||||||
|
|
||||||
def run(names, type)
|
def run(names, type)
|
||||||
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{type}"
|
||||||
|
|
||||||
klass = case type
|
klass = case type
|
||||||
when 'reserved'then ReservedDomain
|
when 'reserved'then ReservedDomain
|
||||||
when 'blocked' then BlockedDomain
|
when 'blocked' then BlockedDomain
|
||||||
|
@ -8,7 +10,6 @@ class UpdateWhoisRecordJob < Que::Job
|
||||||
end
|
end
|
||||||
|
|
||||||
Array(names).each do |name|
|
Array(names).each do |name|
|
||||||
::PaperTrail.whodunnit = "job - #{self.class.name} - #{type}"
|
|
||||||
record = klass.find_by(name: name)
|
record = klass.find_by(name: name)
|
||||||
if record
|
if record
|
||||||
send "update_#{type}", record
|
send "update_#{type}", record
|
||||||
|
|
|
@ -353,7 +353,6 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
||||||
status_notes[DomainStatus::PENDING_DELETE] = ''
|
status_notes[DomainStatus::PENDING_DELETE] = ''
|
||||||
::PaperTrail.whodunnit = "Domain - #{__method__}"
|
|
||||||
|
|
||||||
update_columns(
|
update_columns(
|
||||||
registrant_verification_token: nil,
|
registrant_verification_token: nil,
|
||||||
|
@ -435,7 +434,6 @@ class Domain < ActiveRecord::Base
|
||||||
# TODO: if this were to ever return true, that would be wrong. EPP would report sucess pending
|
# TODO: if this were to ever return true, that would be wrong. EPP would report sucess pending
|
||||||
return true unless registrant_verification_asked?
|
return true unless registrant_verification_asked?
|
||||||
pending_delete_confirmation!
|
pending_delete_confirmation!
|
||||||
::PaperTrail.whodunnit = "#{self.class.name} - #{__method__}"
|
|
||||||
save(validate: false) # should check if this did succeed
|
save(validate: false) # should check if this did succeed
|
||||||
|
|
||||||
DomainMailer.pending_deleted(id, registrant_id_was, deliver_emails).deliver
|
DomainMailer.pending_deleted(id, registrant_id_was, deliver_emails).deliver
|
||||||
|
|
|
@ -3,6 +3,7 @@ class DomainCron
|
||||||
def self.clean_expired_pendings
|
def self.clean_expired_pendings
|
||||||
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
expire_at = Setting.expire_pending_confirmation.hours.ago
|
expire_at = Setting.expire_pending_confirmation.hours.ago
|
||||||
count = 0
|
count = 0
|
||||||
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
||||||
|
@ -13,7 +14,6 @@ class DomainCron
|
||||||
STDOUT << msg unless Rails.env.test?
|
STDOUT << msg unless Rails.env.test?
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
::PaperTrail.whodunnit = "cron - #{__method__}"
|
|
||||||
count += 1
|
count += 1
|
||||||
if domain.pending_update?
|
if domain.pending_update?
|
||||||
DomainMailer.pending_update_expired_notification_for_new_registrant(domain.id).deliver
|
DomainMailer.pending_update_expired_notification_for_new_registrant(domain.id).deliver
|
||||||
|
@ -34,6 +34,7 @@ class DomainCron
|
||||||
def self.start_expire_period
|
def self.start_expire_period
|
||||||
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
domains = Domain.where('valid_to <= ?', Time.zone.now)
|
domains = Domain.where('valid_to <= ?', Time.zone.now)
|
||||||
marked = 0
|
marked = 0
|
||||||
real = 0
|
real = 0
|
||||||
|
@ -42,7 +43,6 @@ class DomainCron
|
||||||
real += 1
|
real += 1
|
||||||
domain.set_graceful_expired
|
domain.set_graceful_expired
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
||||||
::PaperTrail.whodunnit = "cron - #{__method__}"
|
|
||||||
domain.save(validate: false) and marked += 1
|
domain.save(validate: false) and marked += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class DomainCron
|
||||||
def self.start_redemption_grace_period
|
def self.start_redemption_grace_period
|
||||||
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Setting server_hold to domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
|
::PaperTrail.whodunnit = "cron - #{__method__}"
|
||||||
d = Domain.where('outzone_at <= ?', Time.zone.now)
|
d = Domain.where('outzone_at <= ?', Time.zone.now)
|
||||||
marked = 0
|
marked = 0
|
||||||
real = 0
|
real = 0
|
||||||
|
@ -60,7 +61,6 @@ class DomainCron
|
||||||
real += 1
|
real += 1
|
||||||
domain.statuses << DomainStatus::SERVER_HOLD
|
domain.statuses << DomainStatus::SERVER_HOLD
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
||||||
::PaperTrail.whodunnit = "cron - #{__method__}"
|
|
||||||
domain.save(validate: false) and marked += 1
|
domain.save(validate: false) and marked += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue