From e9612b6f1b360333f7c7bf92850d33a7086d38df Mon Sep 17 00:00:00 2001 From: saint Date: Thu, 29 Aug 2024 01:50:55 +1000 Subject: [PATCH] v0.56 Prep to run 20240828 MDT --- gossamer_forums.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index f88328b..2fff55a 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,7 +1,7 @@ # Federated Computer, Inc. # David Sainty 2024 A.D. # Gossamer Threads to Discourse -- Migration-Import Script -# v0.55 Exception handling for topic or user entries in SQLite that are no (longer) in the Discourse DB +# v0.56 Prep to run 20240828 MDT require 'mysql2' require 'open-uri' @@ -737,16 +737,16 @@ class GossamerForumsImporter < ImportScripts::Base discourse_user.user_profile.bio_raw ||= "" # Append bio if it exists, otherwise set it to empty string to avoid nil errors - if discourse_user.user_profile.bio_raw.empty? - discourse_user.user_profile.bio_raw = user[:bio_raw] - else - discourse_user.user_profile.bio_raw += "\n\n" + user[:bio_raw] - end +## if discourse_user.user_profile.bio_raw.empty? + discourse_user.user_profile.bio_raw = user[:bio_raw] +## else +## discourse_user.user_profile.bio_raw += "\n\n" + user[:bio_raw] +## end # Ensure the bio does not exceed 3000 characters - if discourse_user.user_profile.bio_raw.length > 3000 + if discourse_user.user_profile.bio_raw.length > 2999 puts "Warning: About Me for user #{discourse_user.username} (ID: #{discourse_user.id}) exceeds 3000 characters. Truncating." - discourse_user.user_profile.bio_raw = discourse_user.user_profile.bio_raw[0, 3000] + discourse_user.user_profile.bio_raw = discourse_user.user_profile.bio_raw[0, 2999] end discourse_user.user_profile.save! @@ -1994,18 +1994,18 @@ class GossamerForumsImporter < ImportScripts::Base puts "Starting Gossamer Forums import... #{timestamp}" -# add_former_user -# import_users + add_former_user + import_users -# generate_user_id_mapping + generate_user_id_mapping export_username_mapping_to_csv("/bitnami/discourse/sqlite/gossamer-migration-username-mapping#{timestamp}") # set_user_bio_images -# import_categories + import_categories ####### import_topics_and_posts_with_attachments -# threaded_topic_import + threaded_topic_import update_topic_stats update_user_stats