FIX: Restore to S3 didn't work without env variables

FIX: Restore to S3 didn’t work without env variables

The uplaods:migrate_to_s3 rake task should always use the environment variables, because you usually don’t want to break your site’s uploads during the migration. But restoring a backup should work with site settings as well as environment variables, otherwise you can’t restore uploads to S3 from the web interface.

diff --git a/lib/file_store/s3_store.rb b/lib/file_store/s3_store.rb
index 053b23a..6a26ebd 100644
--- a/lib/file_store/s3_store.rb
+++ b/lib/file_store/s3_store.rb
@@ -198,7 +198,7 @@ module FileStore
       FileUtils.symlink(source_path, public_upload_path)
 
       FileStore::ToS3Migration.new(
-        s3_options: FileStore::ToS3Migration.s3_options_from_env,
+        s3_options: FileStore::ToS3Migration.s3_options_from_site_settings,
         migrate_to_multisite: Rails.configuration.multisite,
       ).migrate
 
diff --git a/lib/file_store/to_s3_migration.rb b/lib/file_store/to_s3_migration.rb
index 6792b94..6f19f2d 100644
--- a/lib/file_store/to_s3_migration.rb
+++ b/lib/file_store/to_s3_migration.rb
@@ -21,7 +21,7 @@ module FileStore
     def self.s3_options_from_site_settings
       {
         client_options: S3Helper.s3_options(SiteSetting),
-        bucket: SiteSetting.s3_upload_bucket
+        bucket: SiteSetting.Upload.s3_upload_bucket
       }
     end
 

GitHub sha: c6b411f6

This commit has been mentioned on Discourse Meta. There might be relevant details there: