From 5569afc48b692e2459fe0fa7e3859aa9a6dfffc0 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 19 Aug 2016 21:35:32 +0200 Subject: [PATCH 1/4] phpBB3 importer: Don't ignore users that belong to non-existent group --- script/import_scripts/phpbb3/database/database_3_0.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/import_scripts/phpbb3/database/database_3_0.rb b/script/import_scripts/phpbb3/database/database_3_0.rb index c596b37338a..a54e0540a0b 100644 --- a/script/import_scripts/phpbb3/database/database_3_0.rb +++ b/script/import_scripts/phpbb3/database/database_3_0.rb @@ -7,7 +7,6 @@ module ImportScripts::PhpBB3 count(<<-SQL) SELECT COUNT(*) AS count FROM #{@table_prefix}users u - JOIN #{@table_prefix}groups g ON g.group_id = u.group_id WHERE u.user_type != #{Constants::USER_TYPE_IGNORE} SQL end @@ -18,7 +17,7 @@ module ImportScripts::PhpBB3 u.user_type, u.user_inactive_reason, g.group_name, b.ban_start, b.ban_end, b.ban_reason, u.user_posts, u.user_website, u.user_from, u.user_birthday, u.user_avatar_type, u.user_avatar FROM #{@table_prefix}users u - JOIN #{@table_prefix}groups g ON (g.group_id = u.group_id) + LEFT OUTER JOIN #{@table_prefix}groups g ON (g.group_id = u.group_id) LEFT OUTER JOIN #{@table_prefix}banlist b ON ( u.user_id = b.ban_userid AND b.ban_exclude = 0 AND (b.ban_end = 0 OR b.ban_end >= UNIX_TIMESTAMP()) From b79eef32e7d1c5ea2fc1d7e860cf57df375b9599 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 19 Aug 2016 21:40:07 +0200 Subject: [PATCH 2/4] phpBB3 importer: Make it harder to set wrong table prefix --- script/import_scripts/phpbb3/settings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/import_scripts/phpbb3/settings.yml b/script/import_scripts/phpbb3/settings.yml index e7160a4d8ec..4fd15fc9d0b 100644 --- a/script/import_scripts/phpbb3/settings.yml +++ b/script/import_scripts/phpbb3/settings.yml @@ -7,7 +7,7 @@ database: username: root password: schema: phpbb - table_prefix: phpbb_ # Usually all table names start with phpbb_. Change this, if your forum is using a different prefix. + table_prefix: phpbb_ # Change this, if your forum is using a different prefix. Usually all table names start with phpbb_ batch_size: 1000 # Don't change this unless you know what you're doing. The default (1000) should work just fine. import: From 14a0dff469daa082ba7270ce60bc6aa0f2e980c3 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sun, 5 Feb 2017 15:26:50 +0100 Subject: [PATCH 3/4] phpBB3 importer: Fix import of anonymous users --- script/import_scripts/phpbb3/importers/user_importer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/import_scripts/phpbb3/importers/user_importer.rb b/script/import_scripts/phpbb3/importers/user_importer.rb index 2d98854df10..f7414bb1f0f 100644 --- a/script/import_scripts/phpbb3/importers/user_importer.rb +++ b/script/import_scripts/phpbb3/importers/user_importer.rb @@ -51,7 +51,7 @@ module ImportScripts::PhpBB3 { id: username, - email: "anonymous_no_email_#{SecureRandom.hex}", + email: "anonymous_#{SecureRandom.hex}@no-email.invalid", username: username, name: @settings.username_as_name ? username : '', created_at: Time.zone.at(row[:first_post_time]), From 1fb5dac1bca30cc8fb228e832f4dfe0ee4c41ff4 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sun, 5 Feb 2017 17:13:31 +0100 Subject: [PATCH 4/4] phpBB3 importer: Fix the link regex Thanks to Leo Davidson for the improved regex. https://meta.discourse.org/t/importing-from-phpbb3/30810/153 --- script/import_scripts/phpbb3/support/text_processor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/import_scripts/phpbb3/support/text_processor.rb b/script/import_scripts/phpbb3/support/text_processor.rb index bcdb770fb2f..3eceff3f753 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+)?)(?:\\S*)" + 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)