Start detecting install problems and report them on the admin dashboard. This commit adds check for Rails.env

This commit is contained in:
Neil Lalonde
2013-03-19 23:18:00 -04:00
parent 04c6087ef0
commit 1e4dd3ea0c
9 changed files with 99 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
class AdminDashboardData
REPORTS = ['visits', 'signups', 'topics', 'posts', 'flags', 'users_by_trust_level', 'likes', 'emails']
def self.fetch
AdminDashboardData.new
end
def as_json
@json ||= {
reports: REPORTS.map { |type| Report.find(type) },
total_users: User.count,
problems: [rails_env_check].compact
}.merge(
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
)
end
def rails_env_check
I18n.t("dashboard.rails_env_warning", env: Rails.env) unless Rails.env == 'production'
end
end