diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-03-30 15:45:59 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-30 15:45:59 +0000 |
commit | 22b05a1ff74d4f64490f93995259602b3d07c3cf (patch) | |
tree | e2e1cff25e9e4ab67252b0402cb5df95fdc98d25 /app/models/project.rb | |
parent | 7c36e8561c60882e6b0b47c563f7d19f3d6b02a6 (diff) | |
download | gitlab-ce-22b05a1ff74d4f64490f93995259602b3d07c3cf.tar.gz |
Extend API for exporting a project with direct upload URL
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index da03080f440..b343786d2c9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1544,8 +1544,8 @@ class Project < ActiveRecord::Base @errors = original_errors end - def add_export_job(current_user:, params: {}) - job_id = ProjectExportWorker.perform_async(current_user.id, self.id, params) + def add_export_job(current_user:, after_export_strategy: nil, params: {}) + job_id = ProjectExportWorker.perform_async(current_user.id, self.id, after_export_strategy, params) if job_id Rails.logger.info "Export job started for project ID #{self.id} with job ID #{job_id}" @@ -1571,6 +1571,8 @@ class Project < ActiveRecord::Base def export_status if export_in_progress? :started + elsif after_export_in_progress? + :after_export_action elsif export_project_path :finished else @@ -1582,12 +1584,22 @@ class Project < ActiveRecord::Base import_export_shared.active_export_count > 0 end + def after_export_in_progress? + import_export_shared.after_export_in_progress? + end + def remove_exports return nil unless export_path.present? FileUtils.rm_rf(export_path) end + def remove_exported_project_file + return unless export_project_path.present? + + FileUtils.rm_f(export_project_path) + end + def full_path_slug Gitlab::Utils.slugify(full_path.to_s) end |