mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Merge branch '109259406-punycode' into staging
This commit is contained in:
commit
f606ce4be6
1 changed files with 18 additions and 0 deletions
18
lib/tasks/convert.rake
Normal file
18
lib/tasks/convert.rake
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace :convert do
|
||||||
|
desc 'Convert punycodes to unicode'
|
||||||
|
task punycode: :environment do
|
||||||
|
start = Time.zone.now.to_f
|
||||||
|
|
||||||
|
puts "-----> Convert domain punycodes to unicode..."
|
||||||
|
count = 0
|
||||||
|
Domain.find_each(:batch_size => 1000) do |x|
|
||||||
|
count += 1
|
||||||
|
old_name = x.name.strip.downcase
|
||||||
|
x.name = SimpleIDN.to_unicode(old_name)
|
||||||
|
x.name_puny = SimpleIDN.to_ascii(old_name)
|
||||||
|
x.save(validate: false)
|
||||||
|
end
|
||||||
|
puts "-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue