diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-20 14:05:44 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-20 14:05:44 +0100 |
commit | 2b0e8b86d8aa35ac094d18bfefaa81af916347fa (patch) | |
tree | a0469ccf9e179832b2231c7f2abfa23956a4048f /app/models/namespace.rb | |
parent | 444d71e043eb19979ec1b08504b2760910cb2a47 (diff) | |
parent | c89449e6110c2bdf6e1410bae3e7b7d807c5e305 (diff) | |
download | gitlab-ce-2b0e8b86d8aa35ac094d18bfefaa81af916347fa.tar.gz |
Merge branch 'master' into zj-create-mattermost-team
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 461a38d3e8e..229cbee08c6 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -43,7 +43,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) { @old_repository_storage_paths = repository_storage_paths } + before_destroy(prepend: true) { prepare_for_destroy } after_destroy :rm_dir scope :root, -> { where('type IS NULL') } @@ -212,6 +212,14 @@ class Namespace < ActiveRecord::Base 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 @@ -225,7 +233,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" |