Fix photo exporting, I'm not sure how to use
Kernel::system in this case, so using ``
This commit is contained in:
parent
d0d261fdae
commit
78f2f74186
1 changed files with 4 additions and 7 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
module PhotoMover
|
module PhotoMover
|
||||||
|
|
||||||
def self.move_photos(user)
|
def self.move_photos(user)
|
||||||
|
|
||||||
Dir.chdir Rails.root
|
Dir.chdir Rails.root
|
||||||
temp_dir = "tmp/exports/#{user.id}"
|
temp_dir = "tmp/exports/#{user.id}"
|
||||||
FileUtils::mkdir_p temp_dir
|
FileUtils::mkdir_p temp_dir
|
||||||
|
|
@ -15,14 +13,13 @@ module PhotoMover
|
||||||
photos.each do |photo|
|
photos.each do |photo|
|
||||||
current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.image_filename}"
|
current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.image_filename}"
|
||||||
new_photo_location = "#{photos_dir}/#{photo.image_filename}"
|
new_photo_location = "#{photos_dir}/#{photo.image_filename}"
|
||||||
|
FileUtils::cp current_photo_location, new_photo_location
|
||||||
FileUtils::cp current_photo_location new_photo_location
|
|
||||||
end
|
end
|
||||||
|
|
||||||
system("tar", "cf #{user.id}.tar #{user.id}")
|
`tar c #{user.id} > #{user.id}.tar`
|
||||||
FileUtils::rm_r user.id, :secure => true, :force => true
|
#system("tar", "c", "#{user.id}",">", "#{user.id}.tar")
|
||||||
|
FileUtils::rm_r "#{user.id.to_s}/", :secure => true, :force => true
|
||||||
|
|
||||||
"#{Rails.root}/#{temp_dir}.tar"
|
"#{Rails.root}/#{temp_dir}.tar"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue