More goss-cleanup improvements
This commit is contained in:
parent
8d138d452a
commit
22175ae2c8
@ -1,7 +1,7 @@
|
|||||||
# Federated Computer, Inc.
|
# Federated Computer, Inc.
|
||||||
# David Sainty <saint@federated.computer> 2024 A.D.
|
# David Sainty <saint@federated.computer> 2024 A.D.
|
||||||
# Gossamer Threads to Discourse -- CleanUp Script
|
# Gossamer Threads to Discourse -- CleanUp Script
|
||||||
# v0.16 Add parallel deletion of posts.
|
# v0.17 Add more cleanup options.
|
||||||
|
|
||||||
require 'concurrent-ruby'
|
require 'concurrent-ruby'
|
||||||
require File.expand_path("../../../../config/environment", __FILE__)
|
require File.expand_path("../../../../config/environment", __FILE__)
|
||||||
@ -79,7 +79,7 @@ class GossamerForumsCleaner
|
|||||||
puts "Cleaning up topics with invalid posts_count..."
|
puts "Cleaning up topics with invalid posts_count..."
|
||||||
|
|
||||||
# Iterate through all topics
|
# Iterate through all topics
|
||||||
Topic.where("posts_count IS NULL OR posts_count = -1").find_each do |topic|
|
Topic.where("posts_count IS NULL OR posts_count = -1 OR posts_count = 0").find_each do |topic|
|
||||||
puts "Identified topic for deletion: Title: #{topic.title} Topic ID: #{topic.id}"
|
puts "Identified topic for deletion: Title: #{topic.title} Topic ID: #{topic.id}"
|
||||||
|
|
||||||
# Destroy all posts in the topic
|
# Destroy all posts in the topic
|
||||||
|
Loading…
Reference in New Issue
Block a user