import topic views in phpbb3

This commit is contained in:
Régis Hanol 2018-03-07 19:27:03 +01:00
parent 1093dacc03
commit 07bc52dc69
2 changed files with 2 additions and 1 deletions

View File

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

View File

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