mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:23:22 +08:00
Add destroy rake task
Adds several rake tasks to delete users, topics, pm's and site stats so that you can have a fresh site but maintain site settings and category structure.
This commit is contained in:
39
lib/tasks/destroy.rake
Normal file
39
lib/tasks/destroy.rake
Normal file
@ -0,0 +1,39 @@
|
||||
## These tasks are destructive and are for clearing out all the
|
||||
# content and users from your site, but keeping your site settings,
|
||||
# theme, and category structrue.
|
||||
desc "Remove all topics in a category"
|
||||
task "destroy:topics", [:category] => :environment do |t, args|
|
||||
category = args[:category]
|
||||
puts "Going to delete all topics in the #{category} category"
|
||||
puts log = DestroyTask.destroy_topics(category)
|
||||
end
|
||||
|
||||
desc "Remove all topics in all categories"
|
||||
task "destroy:topics_all_categories" => :environment do
|
||||
puts "Going to delete all topics in all categories..."
|
||||
puts log = DestroyTask.destroy_topics_all_categories
|
||||
end
|
||||
|
||||
desc "Remove all private messages"
|
||||
task "destroy:private_messages" => :environment do
|
||||
puts "Going to delete all private messages..."
|
||||
puts log = DestroyTask.destroy_private_messages
|
||||
end
|
||||
|
||||
desc "Destroy all groups"
|
||||
task "destroy:groups" => :environment do
|
||||
puts "Going to delete all non-default groups..."
|
||||
puts log = DestroyTask.destroy_groups
|
||||
end
|
||||
|
||||
desc "Destroy all non-admin users"
|
||||
task "destroy:users" => :environment do
|
||||
puts "Going to delete all non-admin users..."
|
||||
puts log = DestroyTask.destroy_users
|
||||
end
|
||||
|
||||
desc "Destory site stats"
|
||||
task "destroy:stats" => :environment do
|
||||
puts "Going to delete all site stats..."
|
||||
DestroyTask.destroy_stats
|
||||
end
|
Reference in New Issue
Block a user