system_check.rb 590 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. class Admin::SystemCheck
  3. ACTIVE_CHECKS = [
  4. Admin::SystemCheck::SoftwareVersionCheck,
  5. Admin::SystemCheck::MediaPrivacyCheck,
  6. Admin::SystemCheck::DatabaseSchemaCheck,
  7. Admin::SystemCheck::SidekiqProcessCheck,
  8. Admin::SystemCheck::RulesCheck,
  9. Admin::SystemCheck::ElasticsearchCheck,
  10. ].freeze
  11. def self.perform(current_user)
  12. ACTIVE_CHECKS.each_with_object([]) do |klass, arr|
  13. check = klass.new(current_user)
  14. if check.skip? || check.pass?
  15. arr
  16. else
  17. arr << check.message
  18. end
  19. end
  20. end
  21. end