diff --git a/config/application.rb b/config/application.rb index 6928a18e065..65a9b89a855 100644 --- a/config/application.rb +++ b/config/application.rb @@ -125,9 +125,12 @@ module Discourse Discourse.activate_plugins! end - # So open id logs somewhere sane config.after_initialize do + # So open id logs somewhere sane OpenID::Util.logger = Rails.logger + if plugins = Discourse.plugins + plugins.each{|plugin| plugin.notify_after_initialize} + end end # This is not really required per-se, but we do not want to support diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index 24dc97a5f08..ca74b9c658c 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -67,6 +67,19 @@ class Plugin::Instance File.dirname(path) << "/auto_generated" 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) @styles ||= [] @styles << style