Commit 4e9add7c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'clean_old_archives' into 'master'

Clean old archives from repository downloads directory
parents fae6eb63 944ebb8e
...@@ -13,6 +13,7 @@ v 6.8.0 ...@@ -13,6 +13,7 @@ v 6.8.0
- Allow oauth signup without email for twitter and github - Allow oauth signup without email for twitter and github
- Fix faulty namespace names that caused 500 on user creation - Fix faulty namespace names that caused 500 on user creation
- Option to disable standard login - Option to disable standard login
- Clean old created archives from repository downloads directory
v 6.7.3 v 6.7.3
- Fix the merge notification email not being sent (Pierre de La Morinerie) - Fix the merge notification email not being sent (Pierre de La Morinerie)
......
...@@ -16,6 +16,8 @@ class Projects::RepositoriesController < Projects::ApplicationController ...@@ -16,6 +16,8 @@ class Projects::RepositoriesController < Projects::ApplicationController
storage_path = Gitlab.config.gitlab.repository_downloads_path storage_path = Gitlab.config.gitlab.repository_downloads_path
@repository.clean_old_archives
file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase) file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase)
if file_path if file_path
......
...@@ -215,4 +215,9 @@ class Repository ...@@ -215,4 +215,9 @@ class Repository
def last_commit_for_path(sha, path) def last_commit_for_path(sha, path)
commits(sha, path, 1).last commits(sha, path, 1).last
end end
# Remove archives older than 2 hours
def clean_old_archives
Gitlab::Popen.popen(%W(find #{Gitlab.config.gitlab.repository_downloads_path} -mmin +120 -delete))
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment