Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-03-06 18:24:14 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-03-06 18:24:14 +0300
commit39b393fa72026eeddd141c03696310162304ea98 (patch)
tree0141fded5989d81794e51992d237bd12ff2ea140 /app
parent5e8138aa54492dd3ace42d889ba01f82e8e19c83 (diff)
parent3e71955befba95f823ba92290dedc13a9bf332ff (diff)
Merge branch '29130-api-project-export' into 'master'
Resolve "API endpoint for exporting project" Closes #29130 See merge request gitlab-org/gitlab-ce!15860
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb20
-rw-r--r--app/services/projects/import_export/export_service.rb2
2 files changed, 20 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a11b1e4f554..934b226f46b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1527,16 +1527,34 @@ class Project < ActiveRecord::Base
end
end
+ def import_export_shared
+ @import_export_shared ||= Gitlab::ImportExport::Shared.new(self)
+ end
+
def export_path
return nil unless namespace.present? || hashed_storage?(:repository)
- File.join(Gitlab::ImportExport.storage_path, disk_path)
+ 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 export_project_path
+ :finished
+ else
+ :none
+ end
+ end
+
+ def export_in_progress?
+ import_export_shared.active_export_count > 0
+ end
+
def remove_exports
return nil unless export_path.present?
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb
index fe4e8ea10bf..af41ce82f65 100644
--- a/app/services/projects/import_export/export_service.rb
+++ b/app/services/projects/import_export/export_service.rb
@@ -2,7 +2,7 @@ module Projects
module ImportExport
class ExportService < BaseService
def execute(_options = {})
- @shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.disk_path, 'work'))
+ @shared = project.import_export_shared
save_all
end