From 37a78752e95ed4c5ad89d8eef9859d0a0118ac00 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Wed, 27 Jul 2016 22:57:33 +0200 Subject: [PATCH] phpBB3 importer: fixes for internal links and guest users (#4350) * phpBB3 importer: ignore query parameters in internal links * phpBB3 importer: Don't fail if guest usernames differ only by case * phpBB3 importer: Import username as name for guest users --- script/import_scripts/phpbb3/importers/user_importer.rb | 4 ++-- script/import_scripts/phpbb3/support/text_processor.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/script/import_scripts/phpbb3/importers/user_importer.rb b/script/import_scripts/phpbb3/importers/user_importer.rb index ca50197a9..2d98854df 100644 --- a/script/import_scripts/phpbb3/importers/user_importer.rb +++ b/script/import_scripts/phpbb3/importers/user_importer.rb @@ -51,9 +51,9 @@ module ImportScripts::PhpBB3 { id: username, - email: "anonymous_no_email_#{username}", + email: "anonymous_no_email_#{SecureRandom.hex}", username: username, - name: '', + name: @settings.username_as_name ? username : '', created_at: Time.zone.at(row[:first_post_time]), active: true, trust_level: TrustLevel[0], diff --git a/script/import_scripts/phpbb3/support/text_processor.rb b/script/import_scripts/phpbb3/support/text_processor.rb index edd104f6d..2873d10df 100644 --- a/script/import_scripts/phpbb3/support/text_processor.rb +++ b/script/import_scripts/phpbb3/support/text_processor.rb @@ -137,7 +137,7 @@ module ImportScripts::PhpBB3 def create_internal_link_regexps(original_site_prefix) host = original_site_prefix.gsub('.', '\.') - link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)" + link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)(?:\\S*)" @long_internal_link_regexp = Regexp.new(%Q||, Regexp::IGNORECASE) @short_internal_link_regexp = Regexp.new(link_regex, Regexp::IGNORECASE)