Why does the `SiteSettings` class use the `DistributedCache` without a `require 'distributed_cache';` statement?

https://github.com/discourse/discourse/blob/v2.0.0.beta1/lib/site_settings/defaults_provider.rb#L12-L12

إعجاب واحد (1)

What particular issue is this causing?

If I use require 'site_setting_extension' in my plugin, then I need to remember to add require 'distributed_cache' before.

The trouble is that now you are initializing site settings earlier than when the app does.

Can you post the exact code of what you are trying to achieve.

إعجابَين (2)

I use SiteSettingExtension.module_eval in my plugins to add custom site setting types, e.g.:

require 'distributed_cache'
require 'site_setting_extension'
SiteSettingExtension.module_eval do
	alias_method :core__types, :types
	def types
		result = @types
		if not result
			result = core__types
			result[:paypal_buttons] = result.length + 1;
		end
		return result
	end
end