2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Pages
|
|
|
|
class Settings < ::SimpleDelegator
|
|
|
|
DiskAccessDenied = Class.new(StandardError)
|
|
|
|
|
|
|
|
def path
|
2021-04-29 21:17:54 +05:30
|
|
|
report_denied_disk_access
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
super
|
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def disk_access_denied?
|
|
|
|
return true unless ::Settings.pages.local_store&.enabled
|
|
|
|
|
|
|
|
::Gitlab::Runtime.web_server? && !::Gitlab::Runtime.test_suite?
|
|
|
|
end
|
|
|
|
|
|
|
|
def report_denied_disk_access
|
|
|
|
raise DiskAccessDenied if disk_access_denied?
|
2021-06-08 01:23:25 +05:30
|
|
|
rescue StandardError => e
|
2021-04-29 21:17:54 +05:30
|
|
|
::Gitlab::ErrorTracking.track_exception(e)
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|