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:
authorFelipe Artur <felipefac@gmail.com>2017-02-20 21:41:03 +0300
committerFelipe Artur <felipefac@gmail.com>2017-02-20 21:41:03 +0300
commit46152c2c8b55a5c0968ff87c444e02dd76465c2b (patch)
tree76d8369a37990a21dfd5516a182fa22e77091d6e /app
parent51f82b3bb9779c8ba14216f185648e45738c269f (diff)
Revert "Merge branch 'sh-namespace-cleanup-deleted-projects' into 'master'"
This reverts commit 1f12aaf22dec5399451305f83095c2e92ef50ab6.
Diffstat (limited to 'app')
-rw-r--r--app/models/namespace.rb16
-rw-r--r--app/models/project.rb2
-rw-r--r--app/services/groups/destroy_service.rb27
3 files changed, 2 insertions, 43 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 2afa2ad8d20..c5713fb7818 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -35,7 +35,7 @@ class Namespace < ActiveRecord::Base
after_commit :refresh_access_of_projects_invited_groups, on: :update, if: -> { previous_changes.key?('share_with_group_lock') }
# Save the storage paths before the projects are destroyed to use them on after destroy
- before_destroy(prepend: true) { prepare_for_destroy }
+ before_destroy(prepend: true) { @old_repository_storage_paths = repository_storage_paths }
after_destroy :rm_dir
scope :root, -> { where('type IS NULL') }
@@ -217,18 +217,6 @@ class Namespace < ActiveRecord::Base
[owner_id]
end
- def parent_changed?
- parent_id_changed?
- end
-
- def prepare_for_destroy
- old_repository_storage_paths
- end
-
- def old_repository_storage_paths
- @old_repository_storage_paths ||= repository_storage_paths
- end
-
private
def repository_storage_paths
@@ -242,7 +230,7 @@ class Namespace < ActiveRecord::Base
def rm_dir
# Remove the namespace directory in all storages paths used by member projects
- old_repository_storage_paths.each do |repository_storage_path|
+ @old_repository_storage_paths.each do |repository_storage_path|
# Move namespace directory into trash.
# We will remove it later async
new_path = "#{path}+#{id}+deleted"
diff --git a/app/models/project.rb b/app/models/project.rb
index 5fdc4377309..b45f22d94d9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -214,8 +214,6 @@ class Project < ActiveRecord::Base
# Scopes
default_scope { where(pending_delete: false) }
- scope :with_deleted, -> { unscope(where: :pending_delete) }
-
scope :sorted_by_activity, -> { reorder(last_activity_at: :desc) }
scope :sorted_by_stars, -> { reorder('projects.star_count DESC') }
diff --git a/app/services/groups/destroy_service.rb b/app/services/groups/destroy_service.rb
deleted file mode 100644
index 2e2d7f884ac..00000000000
--- a/app/services/groups/destroy_service.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-module Groups
- class DestroyService < Groups::BaseService
- def async_execute
- # Soft delete via paranoia gem
- group.destroy
- job_id = GroupDestroyWorker.perform_async(group.id, current_user.id)
- Rails.logger.info("User #{current_user.id} scheduled a deletion of group ID #{group.id} with job ID #{job_id}")
- end
-
- def execute
- group.prepare_for_destroy
-
- group.projects.with_deleted.each do |project|
- # Execute the destruction of the models immediately to ensure atomic cleanup.
- # Skip repository removal because we remove directory with namespace
- # that contain all these repositories
- ::Projects::DestroyService.new(project, current_user, skip_repo: true).execute
- end
-
- group.children.each do |group|
- DestroyService.new(group, current_user).async_execute
- end
-
- group.really_destroy!
- end
- end
-end