diff options
author | James Lopez <james@jameslopez.es> | 2018-08-29 15:41:56 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-09-06 16:52:42 +0200 |
commit | a2aa505805478540b3150b2f9093c8658e18597d (patch) | |
tree | 7f080afe99e546f743e14c8efa5c6a30c2527554 /app/models/project.rb | |
parent | a2ea32dd44cc4a104e404325c73a77151913a946 (diff) | |
download | gitlab-ce-a2aa505805478540b3150b2f9093c8658e18597d.tar.gz |
Refactor code to remove object storage flag from Import/Export
Updated docs, refactor import/export code
Fix AvatarUploader path issue
Fix project export upload webhook error
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 97d9fa355ef..35c93aec20a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1733,16 +1733,12 @@ class Project < ActiveRecord::Base import_export_shared.archive_path end - def export_project_path - Dir.glob("#{export_path}/*export.tar.gz").max_by { |f| File.ctime(f) } - end - def export_status if export_in_progress? :started elsif after_export_in_progress? :after_export_action - elsif export_project_path || export_project_object_exists? + elsif export_project_object_exists? :finished else :none @@ -1757,21 +1753,15 @@ class Project < ActiveRecord::Base import_export_shared.after_export_in_progress? end - def remove_exports(path = export_path) - if path.present? - FileUtils.rm_rf(path) - elsif export_project_object_exists? - import_export_upload.remove_export_file! - import_export_upload.save - end - end + def remove_exports + return unless export_project_object_exists? - def remove_exported_project_file - remove_exports(export_project_path) + import_export_upload.remove_export_file! + import_export_upload.save end def export_project_object_exists? - Gitlab::ImportExport.object_storage? && import_export_upload&.export_file&.file + import_export_upload&.export_file&.file end def full_path_slug |