diff --git a/script/import_scripts/phpbb3/database/database_3_0.rb b/script/import_scripts/phpbb3/database/database_3_0.rb index 9d3074d87e..f7fd5e6c10 100644 --- a/script/import_scripts/phpbb3/database/database_3_0.rb +++ b/script/import_scripts/phpbb3/database/database_3_0.rb @@ -15,13 +15,15 @@ module ImportScripts::PhpBB3 query(<<-SQL, :user_id) SELECT u.user_id, u.user_email, u.username, u.user_password, u.user_regdate, u.user_lastvisit, u.user_ip, 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 + u.user_posts, u.user_website, u.user_from, u.user_birthday, u.user_avatar_type, u.user_avatar, + CONCAT_WS(' ', pfd.pf_firstname, pfd.pf_lastname) name FROM #{@table_prefix}users u 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()) ) + LEFT OUTER JOIN #{@table_prefix}profile_fields_data pfd ON (pfd.user_id = u.user_id) WHERE u.user_id > #{last_user_id} AND u.user_type != #{Constants::USER_TYPE_IGNORE} ORDER BY u.user_id LIMIT #{@batch_size} @@ -77,7 +79,7 @@ module ImportScripts::PhpBB3 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, t.topic_status, t.topic_type, t.poll_title, t.topic_views, 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, p.poster_ip, CASE WHEN u.user_type = #{Constants::USER_TYPE_IGNORE} THEN p.post_username ELSE NULL END post_username FROM #{@table_prefix}posts p JOIN #{@table_prefix}topics t ON (p.topic_id = t.topic_id) diff --git a/script/import_scripts/phpbb3/importers/post_importer.rb b/script/import_scripts/phpbb3/importers/post_importer.rb index 7e560747e4..edaf1ccab4 100644 --- a/script/import_scripts/phpbb3/importers/post_importer.rb +++ b/script/import_scripts/phpbb3/importers/post_importer.rb @@ -21,7 +21,7 @@ module ImportScripts::PhpBB3 def map_post(row) imported_user_id = row[:post_username].blank? ? row[:poster_id] : row[:post_username] - user_id = @lookup.user_id_from_imported_user_id(imported_user_id) || Discourse.system_user.id + user_id = @lookup.user_id_from_imported_user_id(imported_user_id) || -1 is_first_post = row[:post_id] == row[:topic_first_post_id] attachments = import_attachments(row, user_id) @@ -58,6 +58,7 @@ module ImportScripts::PhpBB3 mapped[:post_create_action] = proc do |post| @permalink_importer.create_for_topic(post.topic, row[:topic_id]) @permalink_importer.create_for_post(post, row[:post_id]) + TopicViewItem.add(post.topic_id, row[:poster_ip], post.user_id, post.created_at, true) end add_poll(row, mapped) if @settings.import_polls @@ -75,6 +76,7 @@ module ImportScripts::PhpBB3 mapped[:topic_id] = parent[:topic_id] mapped[:post_create_action] = proc do |post| @permalink_importer.create_for_post(post, row[:post_id]) + TopicViewItem.add(post.topic_id, row[:poster_ip], post.user_id, post.created_at, true) end mapped diff --git a/script/import_scripts/phpbb3/importers/user_importer.rb b/script/import_scripts/phpbb3/importers/user_importer.rb index f7414bb1f0..5f8acc6dca 100644 --- a/script/import_scripts/phpbb3/importers/user_importer.rb +++ b/script/import_scripts/phpbb3/importers/user_importer.rb @@ -21,7 +21,7 @@ module ImportScripts::PhpBB3 email: row[:user_email], username: row[:username], password: @settings.import_passwords ? row[:user_password] : nil, - name: @settings.username_as_name ? row[:username] : '', + name: @settings.username_as_name ? row[:username] : row[:name], created_at: Time.zone.at(row[:user_regdate]), last_seen_at: row[:user_lastvisit] == 0 ? Time.zone.at(row[:user_regdate]) : Time.zone.at(row[:user_lastvisit]), registration_ip_address: (IPAddr.new(row[:user_ip]) rescue nil),