v0.22.2 Add debug output for attachment processing

This commit is contained in:
David Sainty 2024-07-01 16:28:27 +10:00
parent b31772e5bb
commit 80b62b018e

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code # gossamer threads migration-import code
# v0.22.1 # v0.22.2
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -983,8 +983,12 @@ class GossamerForumsImporter < ImportScripts::Base
end end
end end
end end
puts "Importing topics and posts with attachments... Done."
end
def update_topic_and_user_stats
# Update topics with the correct last post time, post count, and last post user # Update topics with the correct last post time, post count, and last post user
puts "Update topics with the correct last post time, post count, and last post user"
# topic_last_post_time.each do |topic_id, last_post_time| # topic_last_post_time.each do |topic_id, last_post_time|
# Topic.find(topic_id).update!( # Topic.find(topic_id).update!(
# updated_at: last_post_time, # updated_at: last_post_time,
@ -1006,6 +1010,7 @@ class GossamerForumsImporter < ImportScripts::Base
end end
# Update user profiles with the number of topics and posts created # Update user profiles with the number of topics and posts created
puts "Update user profiles with the number of topics and posts created"
# user_topic_count.each do |user_id, count| # user_topic_count.each do |user_id, count|
# user = User.find(user_id) # user = User.find(user_id)
# user.update!(topic_count: count) # user.update!(topic_count: count)
@ -1026,8 +1031,6 @@ class GossamerForumsImporter < ImportScripts::Base
user.update!(post_count: count) user.update!(post_count: count)
end end
puts "Importing topics and posts with attachments... Done."
end
# Import personal messages from gforum_Message table (both inbox and sent messages) # Import personal messages from gforum_Message table (both inbox and sent messages)
@ -1098,7 +1101,7 @@ class GossamerForumsImporter < ImportScripts::Base
RateLimiter.disable RateLimiter.disable
# Set our unique timestamp for this migration run # Set our unique timestamp for this migration run
timestamp = Time.now.strftime("-%y%m%d%H%M%S") timestamp = Time.now.strftime("-%Y%m%d%H%M%S")
puts "Starting Gossamer Forums import... #{timestamp}" puts "Starting Gossamer Forums import... #{timestamp}"
@ -1106,9 +1109,11 @@ class GossamerForumsImporter < ImportScripts::Base
# export_username_mapping_to_csv("gossamer-migration-username-mapping#{timestamp}") # export_username_mapping_to_csv("gossamer-migration-username-mapping#{timestamp}")
# import_categories # import_categories
import_topics_and_posts_with_attachments import_topics_and_posts_with_attachments
update_topic_and_user_stats
export_url_mapping_to_csv("gossamer-migration-url-mapping#{timestamp}") export_url_mapping_to_csv("gossamer-migration-url-mapping#{timestamp}")
create_nginx_rewrite_rules("gossamer-redirects.conf") create_nginx_rewrite_rules("gossamer-redirects#{timestamp}.conf")
import_personal_messages import_personal_messages