v0.56 Prep to run 20240828 MDT
This commit is contained in:
parent
550da20a89
commit
e9612b6f1b
@ -1,7 +1,7 @@
|
||||
# Federated Computer, Inc.
|
||||
# David Sainty <saint@federated.computer> 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?
|
||||
## 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
|
||||
## 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
|
||||
|
Loading…
Reference in New Issue
Block a user