2016-05-19 07:02:57 -04:00
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class UploadsSaver
|
2016-07-15 10:03:31 -04:00
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
|
2016-05-19 07:02:57 -04:00
|
|
|
def initialize(project:, shared:)
|
|
|
|
@project = project
|
|
|
|
@shared = shared
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
|
|
|
return true unless File.directory?(uploads_path)
|
|
|
|
|
2016-05-19 09:37:21 -04:00
|
|
|
copy_files(uploads_path, uploads_export_path)
|
2016-05-19 07:02:57 -04:00
|
|
|
rescue => e
|
2016-05-19 09:37:21 -04:00
|
|
|
@shared.error(e)
|
2016-05-19 07:02:57 -04:00
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2018-01-29 12:57:34 -05:00
|
|
|
def uploads_path
|
|
|
|
FileUploader.absolute_base_dir(@project)
|
|
|
|
end
|
2016-05-19 07:02:57 -04:00
|
|
|
|
|
|
|
def uploads_export_path
|
|
|
|
File.join(@shared.export_path, 'uploads')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|