diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 12:06:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 12:06:26 +0300 |
commit | 20450649ca3132e55aea60436fa6117ca6c1ae5f (patch) | |
tree | 3b87d2e4b54e72a02dcc4d1af644fbf7269c2c2e /app/services/projects/import_export | |
parent | 3f0f13c6d9f567819d175b499cb437ebf3a63a38 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects/import_export')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index 9c6d7ef41f6..d3638c57552 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -12,6 +12,8 @@ module Projects private + attr_accessor :shared + def execute_after_export_action(after_export_strategy) return unless after_export_strategy @@ -21,50 +23,54 @@ module Projects end def save_all! - if save_services - Gitlab::ImportExport::Saver.save(project: project, shared: @shared) + if save_exporters + Gitlab::ImportExport::Saver.save(project: project, shared: shared) notify_success else cleanup_and_notify_error! end end - def save_services - [version_saver, avatar_saver, project_tree_saver, uploads_saver, repo_saver, wiki_repo_saver, lfs_saver].all?(&:save) + def save_exporters + exporters.all?(&:save) + end + + def exporters + [version_saver, avatar_saver, project_tree_saver, uploads_saver, repo_saver, wiki_repo_saver, lfs_saver] end def version_saver - Gitlab::ImportExport::VersionSaver.new(shared: @shared) + Gitlab::ImportExport::VersionSaver.new(shared: shared) end def avatar_saver - Gitlab::ImportExport::AvatarSaver.new(project: project, shared: @shared) + Gitlab::ImportExport::AvatarSaver.new(project: project, shared: shared) end def project_tree_saver - Gitlab::ImportExport::ProjectTreeSaver.new(project: project, current_user: @current_user, shared: @shared, params: @params) + Gitlab::ImportExport::ProjectTreeSaver.new(project: project, current_user: current_user, shared: shared, params: params) end def uploads_saver - Gitlab::ImportExport::UploadsSaver.new(project: project, shared: @shared) + Gitlab::ImportExport::UploadsSaver.new(project: project, shared: shared) end def repo_saver - Gitlab::ImportExport::RepoSaver.new(project: project, shared: @shared) + Gitlab::ImportExport::RepoSaver.new(project: project, shared: shared) end def wiki_repo_saver - Gitlab::ImportExport::WikiRepoSaver.new(project: project, shared: @shared) + Gitlab::ImportExport::WikiRepoSaver.new(project: project, shared: shared) end def lfs_saver - Gitlab::ImportExport::LfsSaver.new(project: project, shared: @shared) + Gitlab::ImportExport::LfsSaver.new(project: project, shared: shared) end def cleanup_and_notify_error - Rails.logger.error("Import/Export - Project #{project.name} with ID: #{project.id} export error - #{@shared.errors.join(', ')}") # rubocop:disable Gitlab/RailsLogger + Rails.logger.error("Import/Export - Project #{project.name} with ID: #{project.id} export error - #{shared.errors.join(', ')}") # rubocop:disable Gitlab/RailsLogger - FileUtils.rm_rf(@shared.export_path) + FileUtils.rm_rf(shared.export_path) notify_error end @@ -72,7 +78,7 @@ module Projects def cleanup_and_notify_error! cleanup_and_notify_error - raise Gitlab::ImportExport::Error.new(@shared.errors.join(', ')) + raise Gitlab::ImportExport::Error.new(shared.errors.to_sentence) end def notify_success @@ -80,8 +86,10 @@ module Projects end def notify_error - notification_service.project_not_exported(@project, @current_user, @shared.errors) + notification_service.project_not_exported(project, current_user, shared.errors) end end end end + +Projects::ImportExport::ExportService.prepend_if_ee('EE::Projects::ImportExport::ExportService') |