Commit 8b64df58b956ea9c48c090503f921c3b923224b1

Authored by Dmitriy Zaporozhets
2 parents 9351a295 d0b04b03

Merge pull request #4067 from bbodenmiller/patch-5

add code comment about backing up folder when restoring
Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
lib/backup/uploads.rb
@@ -15,11 +15,15 @@ module Backup @@ -15,11 +15,15 @@ module Backup
15 end 15 end
16 16
17 def restore 17 def restore
  18 + backup_existing_uploads_dir
  19 +
  20 + FileUtils.cp_r(backup_uploads_dir, app_uploads_dir)
  21 + end
  22 +
  23 + def backup_existing_uploads_dir
18 if File.exists?(app_uploads_dir) 24 if File.exists?(app_uploads_dir)
19 FileUtils.mv(app_uploads_dir, Rails.root.join('public', "uploads.#{Time.now.to_i}")) 25 FileUtils.mv(app_uploads_dir, Rails.root.join('public', "uploads.#{Time.now.to_i}"))
20 end 26 end
21 -  
22 - FileUtils.cp_r(backup_uploads_dir, app_uploads_dir)  
23 end 27 end
24 end 28 end
25 end 29 end