Make permalink import from phpBB3 configurable

There are a few changes to the original permalink import:
- adds permalinks for posts
- does not create incorrect permalinks for private messages
- adds permalink normalizations for topics and posts
This commit is contained in:
Gerhard Schlager
2016-04-09 22:36:45 +02:00
parent ab0c6e69e9
commit 91b5ea4113
7 changed files with 104 additions and 29 deletions

View File

@ -33,6 +33,12 @@ module ImportScripts::PhpBB3
import_bookmarks if @settings.import_bookmarks
end
def change_site_settings
super
@importers.permalink_importer.change_site_settings
end
def get_site_settings_for_import
settings = super
@ -108,29 +114,6 @@ module ImportScripts::PhpBB3
end
end
# uncomment below lines to create permalink for categories
# def create_category(opts, import_id)
# new_category = super
# url = "viewforum.php?f=#{import_id}"
# if !Permalink.find_by(url: url)
# Permalink.create(url: url, category_id: new_category.id)
# end
# 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
if @settings.fix_private_messages
puts '', 'fixing private messages'
@ -172,8 +155,7 @@ module ImportScripts::PhpBB3
# no need for this since the importer sets last_seen_at for each user during the import
end
# Do not use the bbcode_to_md in base.rb. If enabled, it will be
# used in text_processor.rb instead.
# Do not use the bbcode_to_md in base.rb. It will be used in text_processor.rb instead.
def use_bbcode_to_md?
false
end