2018-04-18 15:30:41 -04:00
|
|
|
require 'disk_space'
|
2018-04-19 12:19:21 -04:00
|
|
|
|
2018-04-16 04:42:06 -04:00
|
|
|
class Admin::DashboardNextController < Admin::AdminController
|
2018-04-18 15:30:41 -04:00
|
|
|
def index
|
2018-07-19 14:33:11 -04:00
|
|
|
data = AdminDashboardNextIndexData.fetch_cached_stats
|
|
|
|
|
|
|
|
if SiteSetting.version_checks?
|
|
|
|
data.merge!(version_check: DiscourseUpdates.check_version.as_json)
|
|
|
|
end
|
|
|
|
|
|
|
|
render json: data
|
|
|
|
end
|
|
|
|
|
2018-08-06 16:57:40 -04:00
|
|
|
def moderation; end
|
2018-07-26 14:59:28 -04:00
|
|
|
|
2018-07-19 14:33:11 -04:00
|
|
|
def general
|
|
|
|
data = AdminDashboardNextGeneralData.fetch_cached_stats
|
|
|
|
|
|
|
|
if SiteSetting.enable_backups
|
|
|
|
data[:last_backup_taken_at] = last_backup_taken_at
|
|
|
|
data[:disk_space] = DiskSpace.cached_stats
|
|
|
|
end
|
|
|
|
|
|
|
|
render json: data
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def last_backup_taken_at
|
2018-08-07 08:19:52 -04:00
|
|
|
if last_backup = Backup.all.first
|
2018-07-19 14:33:11 -04:00
|
|
|
File.ctime(last_backup.path).utc
|
|
|
|
end
|
2018-04-18 15:30:41 -04:00
|
|
|
end
|
2018-04-16 04:42:06 -04:00
|
|
|
end
|