Merge pull request #3632 from gschlager/phpbb3-importer

Fixes some minor issues with the phpBB3 importer
This commit is contained in:
Régis Hanol 2015-07-27 23:38:12 +02:00
commit 52f4ff9a2f
3 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# Importer for phpBB 3.0 and 3.1
# Documentation: https://meta.discourse.org/t/importing-from-phpbb3/30810
if ARGV.length != 1 || !File.exists?(ARGV[0])
STDERR.puts '', 'Usage of phpBB3 importer:', 'bundle exec ruby phpbb3.rb <path/to/settings.yml>'
STDERR.puts '', "Use the settings file from #{File.expand_path('phpbb3/settings.yml', File.dirname(__FILE__))} as an example."
STDERR.puts '', 'Still having problems? Take a look at https://meta.discourse.org/t/importing-from-phpbb3/30810'
exit 1
end

View File

@ -52,11 +52,11 @@ module ImportScripts::PhpBB3
def fetch_categories
query(<<-SQL)
SELECT f.forum_id, f.parent_id, f.forum_name, f.forum_name, f.forum_desc, x.first_post_time
FROM phpbb_forums f
SELECT f.forum_id, f.parent_id, f.forum_name, f.forum_desc, x.first_post_time
FROM #{@table_prefix}_forums f
LEFT OUTER JOIN (
SELECT MIN(topic_time) AS first_post_time, forum_id
FROM phpbb_topics
FROM #{@table_prefix}_topics
GROUP BY forum_id
) x ON (f.forum_id = x.forum_id)
WHERE f.forum_type != #{Constants::FORUM_TYPE_LINK}

View File

@ -122,7 +122,8 @@ module ImportScripts::PhpBB3
end
votes << option_id
else !warned
elsif !warned
warned = true
Rails.logger.warn("Topic with id #{topic_id} has invalid votes.")
end
end