Add Permalink to phpbb3 import script.

This commit is contained in:
Guo Xiang Tan 2016-02-29 11:48:43 +08:00
parent 5dd746d61f
commit 9e46690086
2 changed files with 22 additions and 1 deletions

View File

@ -108,6 +108,26 @@ module ImportScripts::PhpBB3
end end
end end
# uncomment below lines to create permalink for categories
# def create_category(opts, import_id)
# new_category = super
# Permalink.create(url: "viewforum.php?f=#{import_id}", category_id: new_category.id)
# new_category
# end
# uncomment below lines to create permalink for topics
# def create_post(opts, import_id)
# post = super
# if post && (topic = post.topic) && (category = topic.category)
# url = "viewtopic.php?f=#{category.custom_fields["import_id"]}&t=#{opts[:import_topic_id]}"
# if !Permalink.find_by(url: url)
# Permalink.create(url: url, topic_id: topic.id)
# end
# end
# post
# end
def import_private_messages def import_private_messages
if @settings.fix_private_messages if @settings.fix_private_messages
puts '', 'fixing private messages' puts '', 'fixing private messages'

View File

@ -28,7 +28,8 @@ module ImportScripts::PhpBB3
id: row[:post_id], id: row[:post_id],
user_id: user_id, user_id: user_id,
created_at: Time.zone.at(row[:post_time]), created_at: Time.zone.at(row[:post_time]),
raw: @text_processor.process_post(row[:post_text], attachments) raw: @text_processor.process_post(row[:post_text], attachments),
import_topic_id: row[:topic_id]
} }
if is_first_post if is_first_post