mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
phpBB3 importer: Disable file size validators during import
This commit is contained in:
parent
587653ad73
commit
8d9b5ed70a
@ -34,9 +34,32 @@ module ImportScripts::PhpBB3
|
|||||||
end
|
end
|
||||||
|
|
||||||
def change_site_settings
|
def change_site_settings
|
||||||
|
# let's make sure that we import all attachments no matter how big they are
|
||||||
|
setting_keys = [:max_image_size_kb, :max_attachment_size_kb]
|
||||||
|
original_validators = disable_setting_validators(setting_keys)
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
||||||
@importers.permalink_importer.change_site_settings
|
@importers.permalink_importer.change_site_settings
|
||||||
|
|
||||||
|
enable_setting_validators(original_validators)
|
||||||
|
end
|
||||||
|
|
||||||
|
def disable_setting_validators(setting_keys)
|
||||||
|
original_validators = {}
|
||||||
|
|
||||||
|
setting_keys.each do |key|
|
||||||
|
original_validators[key] = SiteSetting.validators[key]
|
||||||
|
SiteSetting.validators[key] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
original_validators
|
||||||
|
end
|
||||||
|
|
||||||
|
def enable_setting_validators(original_validators)
|
||||||
|
original_validators.each do |key, validator|
|
||||||
|
SiteSetting.validators[key] = validator
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_site_settings_for_import
|
def get_site_settings_for_import
|
||||||
|
Loading…
Reference in New Issue
Block a user