diff options
| author | Nick Thomas <nick@gitlab.com> | 2018-01-23 19:03:02 +0000 |
|---|---|---|
| committer | Nick Thomas <nick@gitlab.com> | 2018-02-05 10:38:57 +0000 |
| commit | 30a43b7e04b98616f379bdd800532c3354df8b19 (patch) | |
| tree | 62711e0084cf584b350469e41f5a02e5654de427 /app/models/namespace.rb | |
| parent | f5990e444a98dc259e2af8c373910cd9ec15b0bd (diff) | |
| download | gitlab-ce-30a43b7e04b98616f379bdd800532c3354df8b19.tar.gz | |
Fix export removal for hashed-storage projects within a renamed or deleted namespace
Diffstat (limited to 'app/models/namespace.rb')
| -rw-r--r-- | app/models/namespace.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 5010dd73c11..7b82d076975 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -221,6 +221,24 @@ class Namespace < ActiveRecord::Base has_parent? end + def full_path_was + return path_was unless has_parent? + + "#{parent.full_path}/#{path_was}" + end + + # Exports belonging to projects with legacy storage are placed in a common + # subdirectory of the namespace, so a simple `rm -rf` is sufficient to remove + # them. + # + # Exports of projects using hashed storage are placed in a location defined + # only by the project ID, so each must be removed individually. + def remove_exports! + remove_legacy_exports! + + all_projects.with_storage_feature(:repository).find_each(&:remove_exports) + end + private def refresh_access_of_projects_invited_groups |
