Merge pull request #4688 from gschlager/phpbb3

Fixes for the phpBB3 importer
This commit is contained in:
Régis Hanol 2017-02-05 18:25:19 +01:00 committed by GitHub
commit 767c1da2dc
4 changed files with 4 additions and 5 deletions

View File

@ -7,7 +7,6 @@ module ImportScripts::PhpBB3
count(<<-SQL)
SELECT COUNT(*) AS count
FROM #{@table_prefix}users u
JOIN #{@table_prefix}groups g ON g.group_id = u.group_id
WHERE u.user_type != #{Constants::USER_TYPE_IGNORE}
SQL
end
@ -18,7 +17,7 @@ module ImportScripts::PhpBB3
u.user_type, u.user_inactive_reason, g.group_name, b.ban_start, b.ban_end, b.ban_reason,
u.user_posts, u.user_website, u.user_from, u.user_birthday, u.user_avatar_type, u.user_avatar
FROM #{@table_prefix}users u
JOIN #{@table_prefix}groups g ON (g.group_id = u.group_id)
LEFT OUTER JOIN #{@table_prefix}groups g ON (g.group_id = u.group_id)
LEFT OUTER JOIN #{@table_prefix}banlist b ON (
u.user_id = b.ban_userid AND b.ban_exclude = 0 AND
(b.ban_end = 0 OR b.ban_end >= UNIX_TIMESTAMP())

View File

@ -51,7 +51,7 @@ module ImportScripts::PhpBB3
{
id: username,
email: "anonymous_no_email_#{SecureRandom.hex}",
email: "anonymous_#{SecureRandom.hex}@no-email.invalid",
username: username,
name: @settings.username_as_name ? username : '',
created_at: Time.zone.at(row[:first_post_time]),

View File

@ -7,7 +7,7 @@ database:
username: root
password:
schema: phpbb
table_prefix: phpbb_ # Usually all table names start with phpbb_. Change this, if your forum is using a different prefix.
table_prefix: phpbb_ # Change this, if your forum is using a different prefix. Usually all table names start with phpbb_
batch_size: 1000 # Don't change this unless you know what you're doing. The default (1000) should work just fine.
import:

View File

@ -137,7 +137,7 @@ module ImportScripts::PhpBB3
def create_internal_link_regexps(original_site_prefix)
host = original_site_prefix.gsub('.', '\.')
link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)(?:\\S*)"
link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)(?:[^\\s\\)\\]]*)"
@long_internal_link_regexp = Regexp.new(%Q|<!-- l --><a(?:.+)href="#{link_regex}"(?:.*)</a><!-- l -->|, Regexp::IGNORECASE)
@short_internal_link_regexp = Regexp.new(link_regex, Regexp::IGNORECASE)