mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: LOAD_PLUGINS=0 in dev/prod, warn in plugin:pull_compatible_all (#15537)
The `plugin:pull_compatible_all` task is intended to take incompatible plugins and downgrade them to an earlier version. Problem is, when running the rake task in development/production environments, the plugins have already been activated. If an incompatible plugin raises an error in `plugin.rb` then the rake task will be unable to start. This commit centralises our LOAD_PLUGINS detection, adds support for LOAD_PLUGINS=0 in dev/prod, and adds a warning to `plugin:pull_compatible_all` if it's run with plugins enabled.
This commit is contained in:
@ -30,7 +30,7 @@ require_relative '../lib/plugin_gem'
|
||||
# Global config
|
||||
require_relative '../app/models/global_setting'
|
||||
GlobalSetting.configure!
|
||||
unless Rails.env.test? && ENV['LOAD_PLUGINS'] != "1"
|
||||
if GlobalSetting.load_plugins?
|
||||
require_relative '../lib/custom_setting_providers'
|
||||
end
|
||||
GlobalSetting.load_defaults
|
||||
@ -312,11 +312,9 @@ module Discourse
|
||||
config.relative_url_root = GlobalSetting.relative_url_root
|
||||
end
|
||||
|
||||
if Rails.env == "test"
|
||||
if ENV['LOAD_PLUGINS'] == "1"
|
||||
Discourse.activate_plugins!
|
||||
end
|
||||
else
|
||||
if Rails.env.test? && GlobalSetting.load_plugins?
|
||||
Discourse.activate_plugins!
|
||||
elsif GlobalSetting.load_plugins?
|
||||
plugin_initialization_guard do
|
||||
Discourse.activate_plugins!
|
||||
end
|
||||
|
Reference in New Issue
Block a user