Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Setting for compression level of upload in backups

Gerhard Schlager9eb7dea0f152
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index cf74939b931..65e0d14fe55 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 1e3aaabb796..5eeb1043692 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 e9d5c31503b..1d3f99f5132 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