mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Merge pull request #3632 from gschlager/phpbb3-importer
Fixes some minor issues with the phpBB3 importer
This commit is contained in:
@ -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])
|
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 '', '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 '', "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
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,11 +52,11 @@ module ImportScripts::PhpBB3
|
|||||||
|
|
||||||
def fetch_categories
|
def fetch_categories
|
||||||
query(<<-SQL)
|
query(<<-SQL)
|
||||||
SELECT f.forum_id, f.parent_id, f.forum_name, f.forum_name, f.forum_desc, x.first_post_time
|
SELECT f.forum_id, f.parent_id, f.forum_name, f.forum_desc, x.first_post_time
|
||||||
FROM phpbb_forums f
|
FROM #{@table_prefix}_forums f
|
||||||
LEFT OUTER JOIN (
|
LEFT OUTER JOIN (
|
||||||
SELECT MIN(topic_time) AS first_post_time, forum_id
|
SELECT MIN(topic_time) AS first_post_time, forum_id
|
||||||
FROM phpbb_topics
|
FROM #{@table_prefix}_topics
|
||||||
GROUP BY forum_id
|
GROUP BY forum_id
|
||||||
) x ON (f.forum_id = x.forum_id)
|
) x ON (f.forum_id = x.forum_id)
|
||||||
WHERE f.forum_type != #{Constants::FORUM_TYPE_LINK}
|
WHERE f.forum_type != #{Constants::FORUM_TYPE_LINK}
|
||||||
|
@ -122,7 +122,8 @@ module ImportScripts::PhpBB3
|
|||||||
end
|
end
|
||||||
|
|
||||||
votes << option_id
|
votes << option_id
|
||||||
else !warned
|
elsif !warned
|
||||||
|
warned = true
|
||||||
Rails.logger.warn("Topic with id #{topic_id} has invalid votes.")
|
Rails.logger.warn("Topic with id #{topic_id} has invalid votes.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user