diff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rb index 63d7041cb41..ce29ac3d990 100644 --- a/script/bulk_import/base.rb +++ b/script/bulk_import/base.rb @@ -93,7 +93,7 @@ class BulkImport::Base puts "Loading users indexes..." @last_user_id = User.unscoped.maximum(:id) - @emails = User.unscoped.pluck(:"user_emails.email").to_set + @emails = User.unscoped.joins(:user_emails).pluck(:"user_emails.email").to_set @usernames_lower = User.unscoped.pluck(:username_lower).to_set @mapped_usernames = UserCustomField.joins(:user).where(name: "import_username").pluck("user_custom_fields.value", "users.username").to_h @@ -138,7 +138,7 @@ class BulkImport::Base } USER_COLUMNS ||= %i{ - id username username_lower name email active trust_level admin moderator + id username username_lower name active trust_level admin moderator date_of_birth ip_address registration_ip_address primary_group_id suspended_at suspended_till last_emailed_at created_at updated_at } diff --git a/script/bulk_import/vbulletin.rb b/script/bulk_import/vbulletin.rb index 2121a47b2d3..3d33616b2d6 100644 --- a/script/bulk_import/vbulletin.rb +++ b/script/bulk_import/vbulletin.rb @@ -360,7 +360,8 @@ class BulkImport::VBulletin < BulkImport::Base def parse_birthday(birthday) return if birthday.blank? - date_of_birth = Date.strptime(birthday, "%m-%d-%Y") + date_of_birth = Date.strptime(birthday.gsub(/[^\d-]+/, ""), "%m-%d-%Y") rescue nil + return if date_of_birth.nil? date_of_birth.year < 1904 ? Date.new(1904, date_of_birth.month, date_of_birth.day) : date_of_birth end