FEATURE: Setting for compression level of upload in backups

FEATURE: Setting for compression level of upload in backups

diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index cf74939..65e0d14 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1494,6 +1494,7 @@ en:
     backup_time_of_day: "Time of day UTC when the backup should occur."
     backup_with_uploads: "Include uploads in scheduled backups. Disabling this will only backup the database."
     backup_location: "Location where backups are stored. IMPORTANT: S3 requires valid S3 credentials entered in Files settings."
+    backup_gzip_compression_level_for_uploads: "Gzip compression level used for compressing uploads."
 
     active_user_rate_limit_secs: "How frequently we update the 'last_seen_at' field, in seconds"
     verbose_localization: "Show extended localization tips in the UI"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 1e3aaab..5eeb104 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -1529,6 +1529,11 @@ backups:
     default: "3:30"
     regex: "^((0?(0|1|2|3|4|5|6|7|8|9)|(10|11|12|13|14|15|16|17|18|19|20|21|22|23))):\\d\\d$"
   backup_with_uploads: true
+  backup_gzip_compression_level_for_uploads:
+    default: 1
+    min: 1
+    max: 9
+    shadowed_by_global: true
 
 search:
   min_search_term_length:
diff --git a/lib/backup_restore/backuper.rb b/lib/backup_restore/backuper.rb
index e9d5c31..1d3f99f 100644
--- a/lib/backup_restore/backuper.rb
+++ b/lib/backup_restore/backuper.rb
@@ -248,7 +248,10 @@ module BackupRestore
       remove_tmp_directory
 
       log "Gzipping archive, this may take a while..."
-      Discourse::Utils.execute_command('gzip', '-5', tar_filename, failure_message: "Failed to gzip archive.")
+      Discourse::Utils.execute_command(
+        'gzip', "-#{SiteSetting.backup_gzip_compression_level_for_uploads}", tar_filename,
+        failure_message: "Failed to gzip archive."
+      )
     end
 
     def upload_archive

GitHub sha: 9eb7dea0

Iā€™m curious about the reason why we moved from level 5 to 1? :grin:

See whispers in the relevant meta topic etc

On Tue, Feb 12, 2019 at 1:58 PM Guo Xiang Tan notifications@github.com wrote:

Iā€™m curious about the reason why we moved from level 5 to 1? :grin:

ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/discourse/discourse/commit/9eb7dea0f15234f70ae56785e796c323e3cabde5#commitcomment-32292504, or mute the thread https://github.com/notifications/unsubscribe-auth/ABc7VULC3M7aqBPy2dpE4QXErLbbQADbks5vMzkAgaJpZM4a4I7d .

2 Likes