mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:15:48 +08:00
FEATURE: only export settings that changed via rake task
This commit is contained in:
parent
4000dddd32
commit
550e108a8c
|
@ -1,15 +1,16 @@
|
|||
class SiteSettingsTask
|
||||
def self.export_to_hash
|
||||
def self.export_to_hash(include_defaults: false)
|
||||
site_settings = SiteSetting.all_settings
|
||||
h = {}
|
||||
site_settings.each do |site_setting|
|
||||
next if site_setting[:default] == site_setting[:value] if !include_defaults
|
||||
h.store(site_setting[:setting].to_s, site_setting[:value])
|
||||
end
|
||||
h
|
||||
end
|
||||
|
||||
def self.import(yml)
|
||||
h = SiteSettingsTask.export_to_hash
|
||||
h = SiteSettingsTask.export_to_hash(include_defaults: true)
|
||||
counts = { updated: 0, not_found: 0, errors: 0 }
|
||||
log = []
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@ describe SiteSettingsTask do
|
|||
|
||||
describe 'export' do
|
||||
it 'creates a hash of all site settings' do
|
||||
SiteSetting.sso_url = "https://somewhere.over.com"
|
||||
SiteSetting.enable_sso = true
|
||||
h = SiteSettingsTask.export_to_hash
|
||||
expect(h.count).to be > 0
|
||||
expect(h.count).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user