diff --git a/script/import_scripts/bbpress.rb b/script/import_scripts/bbpress.rb index 3f28d3668..3ea8778ce 100644 --- a/script/import_scripts/bbpress.rb +++ b/script/import_scripts/bbpress.rb @@ -36,10 +36,15 @@ class ImportScripts::Bbpress < ImportScripts::Base user_registered created_at FROM #{table_name 'users'}", cache_rows: false) + puts '', "creating users" + create_users(users_results) do |u| ActiveSupport::HashWithIndifferentAccess.new(u) end + + puts '', '', "creating categories" + create_categories(@client.query("SELECT id, post_name, post_parent from #{table_name 'posts'} WHERE post_type = 'forum' AND post_name != '' ORDER BY post_parent")) do |c| result = {id: c['id'], name: c['post_name']} parent_id = c['post_parent'].to_i @@ -88,6 +93,9 @@ class ImportScripts::Bbpress < ImportScripts::Base mapped[:id] = post["id"] mapped[:user_id] = user_id_from_imported_user_id(post["post_author"]) || find_user_by_import_id(post["post_author"]).try(:id) || -1 mapped[:raw] = post["post_content"] + if mapped[:raw] + mapped[:raw] = mapped[:raw].gsub("
", "```\n").gsub("
", "\n```")
+ end
mapped[:created_at] = post["post_date"]
mapped[:custom_fields] = {import_id: post["id"]}