A platform for community discussion. Free, open, simple.
FIX: phpBB3 importer imported some users as anonymous users
Gerhard Schlagerc26db2116c55
diff --git a/script/import_scripts/phpbb3/database/database_3_0.rb b/script/import_scripts/phpbb3/database/database_3_0.rbindex a54e0540a0b..c82720a6b9c 100644--- a/script/import_scripts/phpbb3/database/database_3_0.rb+++ b/script/import_scripts/phpbb3/database/database_3_0.rb@@ -30,9 +30,10 @@ module ImportScripts::PhpBB3def count_anonymous_userscount(<<-SQL)- SELECT COUNT(DISTINCT post_username) AS count- FROM #{@table_prefix}posts- WHERE post_username <> ''+ SELECT COUNT(DISTINCT p.post_username) AS count+ FROM #{@table_prefix}posts p+ JOIN #{@table_prefix}users u ON (p.poster_id = u.user_id)+ WHERE p.post_username <> '' AND u.user_type = #{Constants::USER_TYPE_IGNORE}SQLend@@ -40,11 +41,12 @@ module ImportScripts::PhpBB3last_username = escape(last_username)query(<<-SQL, :post_username)- SELECT post_username, MIN(post_time) AS first_post_time- FROM #{@table_prefix}posts- WHERE post_username > '#{last_username}'- GROUP BY post_username- ORDER BY post_username+ SELECT p.post_username, MIN(p.post_time) AS first_post_time+ FROM #{@table_prefix}posts p+ JOIN #{@table_prefix}users u ON (p.poster_id = u.user_id)+ WHERE p.post_username > '#{last_username}' AND u.user_type = #{Constants::USER_TYPE_IGNORE}+ GROUP BY p.post_username+ ORDER BY p.post_usernameLIMIT #{@batch_size}SQLend@@ -73,11 +75,13 @@ module ImportScripts::PhpBB3def fetch_posts(last_post_id)query(<<-SQL, :post_id)SELECT p.post_id, p.topic_id, t.forum_id, t.topic_title, t.topic_first_post_id, p.poster_id,- p.post_text, p.post_time, p.post_username, t.topic_status, t.topic_type, t.poll_title,+ p.post_text, p.post_time, t.topic_status, t.topic_type, t.poll_title,CASE WHEN t.poll_length > 0 THEN t.poll_start + t.poll_length ELSE NULL END AS poll_end,- t.poll_max_options, p.post_attachment+ t.poll_max_options, p.post_attachment,+ CASE WHEN u.user_type = #{Constants::USER_TYPE_IGNORE} THEN p.post_username ELSE NULL END post_usernameFROM #{@table_prefix}posts pJOIN #{@table_prefix}topics t ON (p.topic_id = t.topic_id)+ JOIN #{@table_prefix}users u ON (p.poster_id = u.user_id)WHERE p.post_id > #{last_post_id}ORDER BY p.post_idLIMIT #{@batch_size}