2018-11-20 02:01:13 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-05 11:16:17 +00:00
|
|
|
module Gitlab
|
|
|
|
module Verify
|
|
|
|
class Uploads < BatchVerifier
|
|
|
|
def name
|
|
|
|
'Uploads'
|
|
|
|
end
|
|
|
|
|
|
|
|
def describe(object)
|
|
|
|
"Upload: #{object.id}"
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-06-13 17:11:43 +00:00
|
|
|
def all_relation
|
2018-06-19 19:32:01 +00:00
|
|
|
Upload.all.preload(:model)
|
2018-06-13 17:11:43 +00:00
|
|
|
end
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-06-13 17:11:43 +00:00
|
|
|
|
|
|
|
def local?(upload)
|
|
|
|
upload.local?
|
2018-03-05 11:16:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def expected_checksum(upload)
|
|
|
|
upload.checksum
|
|
|
|
end
|
|
|
|
|
|
|
|
def actual_checksum(upload)
|
|
|
|
Upload.hexdigest(upload.absolute_path)
|
|
|
|
end
|
2018-06-13 17:11:43 +00:00
|
|
|
|
|
|
|
def remote_object_exists?(upload)
|
2019-10-03 00:05:59 +00:00
|
|
|
upload.retrieve_uploader.file.exists?
|
2018-06-13 17:11:43 +00:00
|
|
|
end
|
2018-03-05 11:16:17 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|