mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Whois update updates server
This commit is contained in:
parent
3b009dc194
commit
d9b2e5880a
2 changed files with 11 additions and 10 deletions
|
@ -13,6 +13,8 @@ class WhoisRecord < ActiveRecord::Base
|
|||
self.registrar_id = domain.registrar_id # for faster registrar updates
|
||||
end
|
||||
|
||||
after_save :update_whois_server
|
||||
|
||||
class << self
|
||||
def included
|
||||
includes(
|
||||
|
@ -141,7 +143,6 @@ More information at http://internet.ee
|
|||
end
|
||||
|
||||
def update_whois_server
|
||||
return logger.info "NO WHOIS NAME for whois record id: #{id}" if name.blank?
|
||||
wd = Whois::Record.find_or_initialize_by(name: name)
|
||||
wd.body = body
|
||||
wd.json = json
|
||||
|
|
|
@ -16,15 +16,15 @@ namespace :whois do
|
|||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Delete whois database data and import from Registry master database (faster)'
|
||||
task export: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Delete whois database data and import from Registry whois_records table..."
|
||||
whois_records = WhoisRecord.pluck(:name, :body, :json)
|
||||
Whois::Record.delete_all
|
||||
Whois::Record.import([:name, :body, :json], whois_records)
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
# desc 'Delete whois database data and import from Registry master database (faster)'
|
||||
# task export: :environment do
|
||||
# start = Time.zone.now.to_f
|
||||
# print "-----> Delete whois database data and import from Registry whois_records table..."
|
||||
# whois_records = WhoisRecord.pluck(:name, :body, :json)
|
||||
# Whois::Record.delete_all
|
||||
# Whois::Record.import([:name, :body, :json], whois_records)
|
||||
# puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
# end
|
||||
|
||||
namespace :schema do
|
||||
desc 'Load whois schema into empty whois database'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue