Commit 54e40241 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'backup_uploads_symlink' into 'master'

Backup Uploads Symlink
parents b97536a5 a47a6f2a
...@@ -3,7 +3,7 @@ module Backup ...@@ -3,7 +3,7 @@ module Backup
attr_reader :app_uploads_dir, :backup_uploads_dir, :backup_dir attr_reader :app_uploads_dir, :backup_uploads_dir, :backup_dir
def initialize def initialize
@app_uploads_dir = Rails.root.join('public', 'uploads') @app_uploads_dir = File.realpath(Rails.root.join('public', 'uploads'))
@backup_dir = Gitlab.config.backup.path @backup_dir = Gitlab.config.backup.path
@backup_uploads_dir = File.join(Gitlab.config.backup.path, 'uploads') @backup_uploads_dir = File.join(Gitlab.config.backup.path, 'uploads')
end end
...@@ -21,8 +21,9 @@ module Backup ...@@ -21,8 +21,9 @@ module Backup
end end
def backup_existing_uploads_dir def backup_existing_uploads_dir
timestamped_uploads_path = File.join(app_uploads_dir, '..', "uploads.#{Time.now.to_i}")
if File.exists?(app_uploads_dir) if File.exists?(app_uploads_dir)
FileUtils.mv(app_uploads_dir, Rails.root.join('public', "uploads.#{Time.now.to_i}")) FileUtils.mv(app_uploads_dir, timestamped_uploads_path)
end end
end 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