mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FEATURE: Allow plugins to add admin dashboard warnings
This commit is contained in:
@ -32,28 +32,37 @@ class AdminDashboardData
|
||||
|
||||
MOBILE_REPORTS ||= ['mobile_visits'] + ApplicationRequest.req_types.keys.select {|r| r =~ /mobile/}.map { |r| r + "_reqs" }
|
||||
|
||||
def self.add_problem_check(*syms, &blk)
|
||||
@problem_syms ||= []
|
||||
@problem_blocks ||= []
|
||||
|
||||
@problem_syms.push(*syms) if syms
|
||||
@problem_blocks << blk if blk
|
||||
end
|
||||
class << self; attr_reader :problem_syms, :problem_blocks; end
|
||||
|
||||
def problems
|
||||
[ rails_env_check,
|
||||
ruby_version_check,
|
||||
host_names_check,
|
||||
gc_checks,
|
||||
sidekiq_check || queue_size_check,
|
||||
ram_check,
|
||||
google_oauth2_config_check,
|
||||
facebook_config_check,
|
||||
twitter_config_check,
|
||||
github_config_check,
|
||||
s3_config_check,
|
||||
image_magick_check,
|
||||
failing_emails_check,
|
||||
default_logo_check,
|
||||
contact_email_check,
|
||||
send_consumer_email_check,
|
||||
title_check,
|
||||
site_description_check,
|
||||
site_contact_username_check,
|
||||
notification_email_check
|
||||
].compact
|
||||
problems = []
|
||||
AdminDashboardData.problem_syms.each do |sym|
|
||||
problems << send(sym)
|
||||
end
|
||||
AdminDashboardData.problem_blocks.each do |blk|
|
||||
problems << instance_exec(&blk)
|
||||
end
|
||||
problems.compact
|
||||
end
|
||||
|
||||
add_problem_check :rails_env_check, :ruby_version_check, :host_names_check,
|
||||
:gc_checks, :ram_check, :google_oauth2_config_check,
|
||||
:facebook_config_check, :twitter_config_check,
|
||||
:github_config_check, :s3_config_check, :image_magick_check,
|
||||
:failing_emails_check, :default_logo_check, :contact_email_check,
|
||||
:send_consumer_email_check, :title_check,
|
||||
:site_description_check, :site_contact_username_check,
|
||||
:notification_email_check
|
||||
|
||||
add_problem_check do
|
||||
sidekiq_check || queue_size_check
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user