2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
module Gitlab
|
|
|
|
module Verify
|
|
|
|
class Uploads < BatchVerifier
|
|
|
|
def name
|
|
|
|
'Uploads'
|
|
|
|
end
|
|
|
|
|
|
|
|
def describe(object)
|
|
|
|
"Upload: #{object.id}"
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-11-08 19:23:39 +05:30
|
|
|
def all_relation
|
|
|
|
Upload.all.preload(:model)
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
def local?(upload)
|
|
|
|
upload.local?
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def expected_checksum(upload)
|
|
|
|
upload.checksum
|
|
|
|
end
|
|
|
|
|
|
|
|
def actual_checksum(upload)
|
|
|
|
Upload.hexdigest(upload.absolute_path)
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
def remote_object_exists?(upload)
|
2019-12-21 20:55:43 +05:30
|
|
|
upload.retrieve_uploader.file.exists?
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|