v0.14 Code indentation fix and relative path fixes for require at start
This commit is contained in:
parent
30827f69b4
commit
fdb69f2d73
@ -1,5 +1,5 @@
|
||||
# gossamer threads migration-import code
|
||||
# v0.13
|
||||
# v0.14
|
||||
|
||||
require 'mysql2'
|
||||
require 'open-uri'
|
||||
@ -12,8 +12,8 @@ require 'fileutils'
|
||||
require 'csv'
|
||||
require 'time'
|
||||
|
||||
require File.expand_path("../../../config/environment", __FILE__)
|
||||
require_relative 'base'
|
||||
require File.expand_path("../../../../config/environment", __FILE__)
|
||||
require_relative '../base'
|
||||
|
||||
class GossamerForumsImporter < ImportScripts::Base
|
||||
def initialize
|
||||
@ -483,14 +483,14 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
title
|
||||
end
|
||||
|
||||
# Import topics and posts from Gossamer Forums to Discourse
|
||||
def import_topics_and_posts_with_attachments
|
||||
# Import topics and posts from Gossamer Forums to Discourse
|
||||
def import_topics_and_posts_with_attachments
|
||||
puts "Importing topics and posts with attachments..."
|
||||
|
||||
# Execute the query to get all posts ordered by post_id
|
||||
execute_query("SELECT * FROM gforum_Post ORDER BY post_id").each do |row|
|
||||
puts "post_id #{row['post_id']} post_root_id #{row['post_root_id']} post_subject/title #{row['post_subject']} forum_id_fk/category_id #{row['forum_id_fk']}"
|
||||
# discourse_user_id = @user_id_map[row['user_id_fk']]
|
||||
# discourse_user_id = @user_id_map[row['user_id_fk']]
|
||||
discourse_user_id = fetch_user_id_mapping(row['user_id_fk'])
|
||||
discourse_category_id = fetch_category_id_mapping(row['forum_id_fk'])
|
||||
puts "discourse_user_id #{discourse_user_id} discourse_category_id #{discourse_category_id}"
|
||||
@ -549,7 +549,6 @@ def import_topics_and_posts_with_attachments
|
||||
puts "Error importing topic with post_id #{row['post_id']}: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
puts "#3"
|
||||
# Find the root topic for the post
|
||||
@ -594,11 +593,11 @@ def import_topics_and_posts_with_attachments
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Import personal messages from gforum_Message table (both inbox and sent messages)
|
||||
def import_personal_messages
|
||||
# Import personal messages from gforum_Message table (both inbox and sent messages)
|
||||
def import_personal_messages
|
||||
puts "Importing personal (inbox and sendmail) messages..."
|
||||
execute_query("SELECT * FROM gforum_Message").each do |row|
|
||||
|
||||
@ -655,7 +654,7 @@ def import_personal_messages
|
||||
# handle_post_attachments(row['msg_id'], post, from_user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user