diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 2546b661eae..ead0601395c 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -253,7 +253,7 @@ class ImportScripts::Base if user_id_from_imported_user_id(import_id) skipped += 1 - elsif u[:email].present? + else new_user = create_user(u, import_id) created_user(new_user) @@ -270,9 +270,6 @@ class ImportScripts::Base end end end - else - failed += 1 - puts "Skipping user id #{import_id} because email is blank" end end @@ -314,8 +311,8 @@ class ImportScripts::Base opts[:username] = UserNameSuggester.suggest(opts[:username] || opts[:name].presence || opts[:email]) end - unless opts[:email].match(EmailValidator.email_regex) - opts[:email] = "invalid#{SecureRandom.hex}@no-email.invalid" + unless opts[:email][EmailValidator.email_regex] + opts[:email] = fake_email puts "Invalid email #{original_email} for #{opts[:username]}. Using: #{opts[:email]}" end @@ -881,4 +878,8 @@ class ImportScripts::Base offset += batch_size end end + + def fake_email + SecureRandom.hex << "@domain.com" + end end diff --git a/script/import_scripts/lithium.rb b/script/import_scripts/lithium.rb index 442df14f8a4..834f97cec28 100644 --- a/script/import_scripts/lithium.rb +++ b/script/import_scripts/lithium.rb @@ -1032,10 +1032,6 @@ SQL html end - def fake_email - SecureRandom.hex << "@domain.com" - end - def mysql_query(sql) @client.query(sql, cache_rows: true) end diff --git a/script/import_scripts/nodebb/nodebb.rb b/script/import_scripts/nodebb/nodebb.rb index 1c9acfef222..3e5c616a5d6 100644 --- a/script/import_scripts/nodebb/nodebb.rb +++ b/script/import_scripts/nodebb/nodebb.rb @@ -518,10 +518,6 @@ class ImportScripts::NodeBB < ImportScripts::Base raw end - - def fake_email - SecureRandom.hex << "@domain.com" - end end ImportScripts::NodeBB.new.perform diff --git a/script/import_scripts/question2answer.rb b/script/import_scripts/question2answer.rb index 49eb3eddc51..f9d248791b5 100644 --- a/script/import_scripts/question2answer.rb +++ b/script/import_scripts/question2answer.rb @@ -551,10 +551,6 @@ EOM Time.zone.at(@tz.utc_to_local(timestamp)) end - def fake_email - SecureRandom.hex << "@domain.com" - end - def mysql_query(sql) @client.query(sql, cache_rows: true) end diff --git a/script/import_scripts/vbulletin.rb b/script/import_scripts/vbulletin.rb index ce1af98c963..092d8d536bd 100644 --- a/script/import_scripts/vbulletin.rb +++ b/script/import_scripts/vbulletin.rb @@ -931,10 +931,6 @@ EOM Time.zone.at(@tz.utc_to_local(timestamp)) end - def fake_email - SecureRandom.hex << "@domain.com" - end - def mysql_query(sql) @client.query(sql, cache_rows: true) end diff --git a/script/import_scripts/vbulletin5.rb b/script/import_scripts/vbulletin5.rb index 36a46745b5d..1bab839561b 100644 --- a/script/import_scripts/vbulletin5.rb +++ b/script/import_scripts/vbulletin5.rb @@ -621,10 +621,6 @@ class ImportScripts::VBulletin < ImportScripts::Base Time.zone.at(@tz.utc_to_local(timestamp)) end - def fake_email - SecureRandom.hex << "@domain.com" - end - def mysql_query(sql) @client.query(sql, cache_rows: false) end