Skip to content

Commit c98add1

Browse files
committed
Merge branch 'clean_carrierwave_tempfiles' into 'master'
Clean carrierwave tempfiles Closes #28540 See merge request !9466
2 parents 01adf92 + ad27f20 commit c98add1

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

app/uploaders/file_uploader.rb

-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ def store_dir
3838
File.join(dynamic_path_segment, @secret)
3939
end
4040

41-
def cache_dir
42-
File.join(base_dir, 'tmp', @project.path_with_namespace, @secret)
43-
end
44-
4541
def model
4642
project
4743
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Periodically clean up temporary upload files to recover storage space
3+
merge_request: 9466
4+
author: blackst0ne
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
2+
# for more information on how to write migrations for GitLab.
3+
4+
# Remove all files from old custom carrierwave's cache directories.
5+
# See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9466
6+
7+
class RemoveOldCacheDirectories < ActiveRecord::Migration
8+
include Gitlab::Database::MigrationHelpers
9+
10+
DOWNTIME = false
11+
12+
disable_ddl_transaction!
13+
14+
def up
15+
# FileUploader cache.
16+
FileUtils.rm_rf(Dir[Rails.root.join('public', 'uploads', 'tmp', '*')])
17+
end
18+
19+
def down
20+
# Old cache is not supposed to be recoverable.
21+
# So the down method is empty.
22+
end
23+
end

db/schema.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20170407140450) do
14+
ActiveRecord::Schema.define(version: 20170408033905) do
1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
1717
enable_extension "pg_trgm"

0 commit comments

Comments
 (0)