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