mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Add configurable? helper to Plugin::Instance (#21472)
This reapplies commit 3073e5cfb0721b3b8009963c5fc7f61d414db317, with a fix that makes sure that plugins can be looked up both by the name present in metadata and directory name.
This commit is contained in:
@ -346,7 +346,11 @@ class ApplicationController < ActionController::Base
|
||||
# disabled. This allows plugins to be disabled programmatically.
|
||||
def self.requires_plugin(plugin_name)
|
||||
before_action do
|
||||
raise PluginDisabled.new if Discourse.disabled_plugin_names.include?(plugin_name)
|
||||
if plugin = Discourse.plugins_by_name[plugin_name]
|
||||
raise PluginDisabled.new if !plugin.enabled?
|
||||
else
|
||||
Rails.logger.warn("Required plugin '#{plugin_name}' not found")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user