mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 12:42:57 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
39 lines
765 B
Ruby
39 lines
765 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'yaml'
|
|
|
|
desc "Exports site settings"
|
|
task "site_settings:export" => :environment do
|
|
h = SiteSettingsTask.export_to_hash
|
|
puts h.to_yaml
|
|
end
|
|
|
|
desc "Imports site settings"
|
|
task "site_settings:import" => :environment do
|
|
yml = (STDIN.tty?) ? '' : STDIN.read
|
|
if yml == ''
|
|
puts
|
|
puts "Please specify a settings yml file"
|
|
puts "Example: rake site_settings:import < settings.yml"
|
|
exit 1
|
|
end
|
|
|
|
puts
|
|
puts "starting import..."
|
|
puts
|
|
|
|
log, counts = SiteSettingsTask.import(yml)
|
|
|
|
puts log
|
|
|
|
puts
|
|
puts "Results:"
|
|
puts " Updated: #{counts[:updated]}"
|
|
puts " Not Found: #{counts[:not_found]}"
|
|
puts " Errors: #{counts[:errors]}"
|
|
|
|
if counts[:not_found] + counts[:errors] > 0
|
|
exit 1
|
|
end
|
|
end
|