DEV: Improve phpBB3 import script (#15956)
* Optional import of custom user fields from phpBB 3.1+ * Optional import of likes from phpBB3 Requires the phpBB "Thanks for posts" extension * Fix import of bookmarks from phpBB3 * Update `created_at` of existing user * Support mapping of phpBB forums to existing Discourse categories This is in addition to the ability of merging phpBB forums and importing into newly created Discourse categories.
This commit is contained in:
@@ -13,7 +13,7 @@ module ImportScripts::PhpBB3
|
||||
SQL
|
||||
end
|
||||
|
||||
def fetch_users(last_user_id)
|
||||
def fetch_users(last_user_id, _profile_fields)
|
||||
query(<<-SQL, :user_id)
|
||||
SELECT u.user_id, u.user_email, u.username, u.user_password, u.user_regdate, u.user_lastvisit, u.user_ip,
|
||||
u.user_type, u.user_inactive_reason, g.group_name, b.ban_start, b.ban_end, b.ban_reason,
|
||||
@@ -227,12 +227,31 @@ module ImportScripts::PhpBB3
|
||||
SELECT b.user_id, t.topic_first_post_id
|
||||
FROM #{@table_prefix}bookmarks b
|
||||
JOIN #{@table_prefix}topics t ON (b.topic_id = t.topic_id)
|
||||
WHERE b.user_id > #{last_user_id}
|
||||
WHERE (b.user_id, b.topic_id) > (#{last_user_id}, #{last_topic_id})
|
||||
ORDER BY b.user_id, b.topic_id
|
||||
LIMIT #{@batch_size}
|
||||
SQL
|
||||
end
|
||||
|
||||
def count_likes
|
||||
count(<<-SQL)
|
||||
SELECT COUNT(*) AS count
|
||||
FROM #{@table_prefix}thanks
|
||||
WHERE user_id <> poster_id
|
||||
SQL
|
||||
end
|
||||
|
||||
def fetch_likes(last_post_id, last_user_id)
|
||||
query(<<-SQL, :post_id, :user_id)
|
||||
SELECT post_id, user_id, thanks_time
|
||||
FROM #{@table_prefix}thanks
|
||||
WHERE user_id <> poster_id
|
||||
AND (post_id, user_id) > (#{last_post_id}, #{last_user_id})
|
||||
ORDER BY post_id, user_id
|
||||
LIMIT #{@batch_size}
|
||||
SQL
|
||||
end
|
||||
|
||||
def get_smiley(smiley_code)
|
||||
query(<<-SQL).first
|
||||
SELECT emotion, smiley_url
|
||||
|
||||
Reference in New Issue
Block a user