after_initialize callback for plugins
This commit is contained in:
parent
ba2c4139fe
commit
6af1e12cc1
|
@ -125,9 +125,12 @@ module Discourse
|
||||||
Discourse.activate_plugins!
|
Discourse.activate_plugins!
|
||||||
end
|
end
|
||||||
|
|
||||||
# So open id logs somewhere sane
|
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
|
# So open id logs somewhere sane
|
||||||
OpenID::Util.logger = Rails.logger
|
OpenID::Util.logger = Rails.logger
|
||||||
|
if plugins = Discourse.plugins
|
||||||
|
plugins.each{|plugin| plugin.notify_after_initialize}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is not really required per-se, but we do not want to support
|
# This is not really required per-se, but we do not want to support
|
||||||
|
|
|
@ -67,6 +67,19 @@ class Plugin::Instance
|
||||||
File.dirname(path) << "/auto_generated"
|
File.dirname(path) << "/auto_generated"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def after_initialize(&block)
|
||||||
|
@after_initialize ||= []
|
||||||
|
@after_initialize << block
|
||||||
|
end
|
||||||
|
|
||||||
|
def notify_after_initialize
|
||||||
|
if @after_initialize
|
||||||
|
@after_initialize.each do |callback|
|
||||||
|
callback.call
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def register_css(style)
|
def register_css(style)
|
||||||
@styles ||= []
|
@styles ||= []
|
||||||
@styles << style
|
@styles << style
|
||||||
|
|
Loading…
Reference in New Issue