diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-17 15:25:57 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-17 15:25:57 +0100 |
commit | 64d8a38b54500e4c359f510c0ee15ab8fadc9f18 (patch) | |
tree | e5d1dc907b79a3a25f4679307f5603fce197376b /app/services | |
parent | b3bd7c1999a1b2a662c029a608bcf25d50e9ee82 (diff) | |
parent | 28d42a33f3385b57660906d4ca35e96d56785d7e (diff) | |
download | gitlab-ce-64d8a38b54500e4c359f510c0ee15ab8fadc9f18.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into git-archive-refactorgit-archive-refactor
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/projects/destroy_service.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index 294157b4f0e..f4dcb142850 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -16,11 +16,15 @@ module Projects return false unless can?(current_user, :remove_project, project) project.team.truncate - project.repository.expire_cache unless project.empty_repo? repo_path = project.path_with_namespace wiki_path = repo_path + '.wiki' + # Flush the cache for both repositories. This has to be done _before_ + # removing the physical repositories as some expiration code depends on + # Git data (e.g. a list of branch names). + flush_caches(project, wiki_path) + Project.transaction do project.destroy! @@ -70,5 +74,13 @@ module Projects def removal_path(path) "#{path}+#{project.id}#{DELETED_FLAG}" end + + def flush_caches(project, wiki_path) + project.repository.expire_all_caches! if project.repository.exists? + + wiki_repo = Repository.new(wiki_path, project) + + wiki_repo.expire_all_caches! if wiki_repo.exists? + end end end |