Class: Gitlab::ImportExport::UploadsManager
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::UploadsManager
- Defined in:
- lib/gitlab/import_export/uploads_manager.rb
Constant Summary collapse
- UPLOADS_BATCH_SIZE =
100
Constants included from Import::Framework::ProgressTracking
Import::Framework::ProgressTracking::CACHE_EXPIRATION
Constants included from CommandLineUtil
CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, CommandLineUtil::CommandLineUtilError, CommandLineUtil::DEFAULT_DIR_MODE, CommandLineUtil::FileOversizedError, CommandLineUtil::HardLinkError, CommandLineUtil::UNTAR_MASK
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project:, shared:, relative_export_path: 'uploads') ⇒ UploadsManager
constructor
A new instance of UploadsManager.
- #restore ⇒ Object
- #save ⇒ Object
Methods included from Import::Framework::ProgressTracking
#processed_entry?, #save_processed_entry, #with_progress_tracking
Methods included from CommandLineUtil
#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf
Constructor Details
#initialize(project:, shared:, relative_export_path: 'uploads') ⇒ UploadsManager
Returns a new instance of UploadsManager.
13 14 15 16 17 |
# File 'lib/gitlab/import_export/uploads_manager.rb', line 13 def initialize(project:, shared:, relative_export_path: 'uploads') @project = project @shared = shared @relative_export_path = relative_export_path end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
11 12 13 |
# File 'lib/gitlab/import_export/uploads_manager.rb', line 11 def project @project end |
Instance Method Details
#restore ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab/import_export/uploads_manager.rb', line 28 def restore Dir["#{uploads_export_path}/**/*"].each do |upload| next if File.directory?(upload) with_progress_tracking(**(upload)) do add_upload(upload) end end true rescue StandardError => e @shared.error(e) false end |
#save ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/import_export/uploads_manager.rb', line 19 def save copy_project_uploads true rescue StandardError => e @shared.error(e) false end |