mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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
|
class SiteSettingsTask
|
||||||
def self.export_to_hash
|
def self.export_to_hash(include_defaults: false)
|
||||||
site_settings = SiteSetting.all_settings
|
site_settings = SiteSetting.all_settings
|
||||||
h = {}
|
h = {}
|
||||||
site_settings.each do |site_setting|
|
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])
|
h.store(site_setting[:setting].to_s, site_setting[:value])
|
||||||
end
|
end
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.import(yml)
|
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 }
|
counts = { updated: 0, not_found: 0, errors: 0 }
|
||||||
log = []
|
log = []
|
||||||
|
|
||||||
|
@ -8,8 +8,10 @@ describe SiteSettingsTask do
|
|||||||
|
|
||||||
describe 'export' do
|
describe 'export' do
|
||||||
it 'creates a hash of all site settings' 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
|
h = SiteSettingsTask.export_to_hash
|
||||||
expect(h.count).to be > 0
|
expect(h.count).to eq(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user