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
This commit is contained in:
Gerhard Schlager 2016-07-27 22:57:33 +02:00 committed by Régis Hanol
parent fccc0c93c5
commit 37a78752e9
2 changed files with 3 additions and 3 deletions

View file

@ -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],

View file

@ -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|<!-- l --><a(?:.+)href="#{link_regex}"(?:.*)</a><!-- l -->|, Regexp::IGNORECASE)
@short_internal_link_regexp = Regexp.new(link_regex, Regexp::IGNORECASE)