Commit d0b04b03b488bc5c78dfdadca61fbbccffd4853b
1 parent
d58aca06
Exists in
master
and in
4 other branches
clarify restore
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 |