mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
DEV: Allow disabling problem checks programatically (#28440)
We need a way to disable certain checks programatically, e.g. on Discourse hosting. This PR adds a configuration option for this, and makes it so that disabled checks aren't run as part of #run_all.
This commit is contained in:
@ -13,7 +13,7 @@ class ProblemCheck
|
||||
end
|
||||
|
||||
def run_all
|
||||
each(&:run)
|
||||
select(&:enabled?).each(&:run)
|
||||
end
|
||||
|
||||
private
|
||||
@ -23,6 +23,7 @@ class ProblemCheck
|
||||
|
||||
include ActiveSupport::Configurable
|
||||
|
||||
config_accessor :enabled, default: true, instance_writer: false
|
||||
config_accessor :priority, default: "low", instance_writer: false
|
||||
|
||||
# Determines if the check should be performed at a regular interval, and if
|
||||
@ -112,6 +113,11 @@ class ProblemCheck
|
||||
end
|
||||
delegate :identifier, to: :class
|
||||
|
||||
def self.enabled?
|
||||
enabled
|
||||
end
|
||||
delegate :enabled?, to: :class
|
||||
|
||||
def self.scheduled?
|
||||
perform_every.present?
|
||||
end
|
||||
|
Reference in New Issue
Block a user