gitlab-org--gitlab-foss/lib/gitlab/import_export/uploads_restorer.rb

32 lines
747 B
Ruby
Raw Normal View History

module Gitlab
module ImportExport
class UploadsRestorer < UploadsSaver
def restore
2018-07-11 09:36:59 +00:00
if Gitlab::ImportExport.object_storage?
Gitlab::ImportExport::UploadsManager.new(
project: @project,
shared: @shared
).restore
elsif File.directory?(uploads_export_path)
copy_files(uploads_export_path, uploads_path)
2018-07-11 13:58:42 +00:00
true
2018-07-11 09:36:59 +00:00
else
2018-07-16 09:45:11 +00:00
true # Proceed without uploads
2018-07-11 09:36:59 +00:00
end
rescue => e
@shared.error(e)
false
end
2018-07-11 10:02:01 +00:00
def uploads_path
FileUploader.absolute_base_dir(@project)
end
2018-07-12 06:46:24 +00:00
def uploads_export_path
@uploads_export_path ||= File.join(@shared.export_path, 'uploads')
end
end
end
end