Skip to content

A platform for community discussion. Free, open, simple.

import topic views in phpbb3

Régis Hanol07bc52dc6958
diff --git a/script/import_scripts/phpbb3/database/database_3_0.rb b/script/import_scripts/phpbb3/database/database_3_0.rb
index c82720a6b9c..9d3074d87ee 100644
--- a/script/import_scripts/phpbb3/database/database_3_0.rb
+++ b/script/import_scripts/phpbb3/database/database_3_0.rb
@@ -75,7 +75,7 @@ module ImportScripts::PhpBB3
def 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, t.topic_status, t.topic_type, t.poll_title,
+ 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,
CASE WHEN u.user_type = #{Constants::USER_TYPE_IGNORE} THEN p.post_username ELSE NULL END post_username
diff --git a/script/import_scripts/phpbb3/importers/post_importer.rb b/script/import_scripts/phpbb3/importers/post_importer.rb
index 051695585b7..7e560747e40 100644
--- a/script/import_scripts/phpbb3/importers/post_importer.rb
+++ b/script/import_scripts/phpbb3/importers/post_importer.rb
@@ -54,6 +54,7 @@ module ImportScripts::PhpBB3
mapped[:title] = CGI.unescapeHTML(row[:topic_title]).strip[0...255]
mapped[:pinned_at] = mapped[:created_at] unless row[:topic_type] == Constants::POST_NORMAL
mapped[:pinned_globally] = row[:topic_type] == Constants::POST_GLOBAL
+ mapped[:views] = row[:topic_views]
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])