Revert "FIX: migrate_to_s3 rake task with folder path"
This reverts commit 97fd12e8af
.
This commit is contained in:
parent
4a01fee41b
commit
3ec38f5a3b
|
@ -251,18 +251,15 @@ def migrate_to_s3
|
||||||
bucket, folder = S3Helper.get_bucket_and_folder_path(ENV["DISCOURSE_S3_BUCKET"])
|
bucket, folder = S3Helper.get_bucket_and_folder_path(ENV["DISCOURSE_S3_BUCKET"])
|
||||||
folder = File.join(folder, "/")
|
folder = File.join(folder, "/")
|
||||||
else
|
else
|
||||||
bucket = GlobalSetting.s3_bucket
|
bucket, folder = GlobalSetting.s3_bucket, ""
|
||||||
folder = ""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
unless bucket_has_folder_path
|
|
||||||
begin
|
begin
|
||||||
s3.head_bucket(bucket: bucket)
|
s3.head_bucket(bucket: bucket)
|
||||||
rescue Aws::S3::Errors::NotFound
|
rescue Aws::S3::Errors::NotFound
|
||||||
puts "Bucket '#{bucket}' not found. Creating it..."
|
puts "Bucket '#{bucket}' not found. Creating it..."
|
||||||
s3.create_bucket(bucket: bucket) unless dry_run
|
s3.create_bucket(bucket: bucket) unless dry_run
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
puts "Uploading files to S3..."
|
puts "Uploading files to S3..."
|
||||||
print " - Listing local files"
|
print " - Listing local files"
|
||||||
|
@ -277,7 +274,7 @@ def migrate_to_s3
|
||||||
print " - Listing S3 files"
|
print " - Listing S3 files"
|
||||||
|
|
||||||
s3_objects = []
|
s3_objects = []
|
||||||
prefix = Rails.configuration.multisite ? "#{folder}#{db}/original/" : "#{folder}original/"
|
prefix = Rails.configuration.multisite ? "#{db}/original/" : "original/"
|
||||||
options = { bucket: bucket, prefix: prefix }
|
options = { bucket: bucket, prefix: prefix }
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
|
|
Loading…
Reference in New Issue