A platform for community discussion. Free, open, simple.
FIX: Failed to restore backups from versions without translation overrides
Gerhard Schlager8022e5117941
diff --git a/config/initializers/100-i18n.rb b/config/initializers/100-i18n.rbindex 10749264a41..739fca222dd 100644--- a/config/initializers/100-i18n.rb+++ b/config/initializers/100-i18n.rb@@ -9,7 +9,7 @@ I18n.backend = I18n::Backend::DiscourseI18n.newI18n.fallbacks = I18n::Backend::FallbackLocaleList.newI18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }I18n.reload!-I18n.init_accelerator!+I18n.init_accelerator!(overrides_enabled: ENV['DISABLE_TRANSLATION_OVERRIDES'] != '1')unless Rails.env.test?MessageBus.subscribe("/i18n-flush") dodiff --git a/lib/backup_restore/database_restorer.rb b/lib/backup_restore/database_restorer.rbindex d0880c97edd..929e318a9f4 100644--- a/lib/backup_restore/database_restorer.rb+++ b/lib/backup_restore/database_restorer.rb@@ -134,7 +134,11 @@ module BackupRestorelog "Migrating the database..."log Discourse::Utils.execute_command(- { "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0", "SKIP_OPTIMIZE_ICONS" => "1" },+ {+ "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0",+ "SKIP_OPTIMIZE_ICONS" => "1",+ "DISABLE_TRANSLATION_OVERRIDES" => "1"+ },"rake db:migrate",failure_message: "Failed to migrate database.",chdir: Rails.rootdiff --git a/lib/freedom_patches/translate_accelerator.rb b/lib/freedom_patches/translate_accelerator.rbindex 704da6ec4b9..ee724d56d12 100644--- a/lib/freedom_patches/translate_accelerator.rb+++ b/lib/freedom_patches/translate_accelerator.rb@@ -21,8 +21,8 @@ module I18nLRU_CACHE_SIZE = 400- def init_accelerator!- @overrides_enabled = true+ def init_accelerator!(overrides_enabled: true)+ @overrides_enabled = overrides_enabledexecute_reloadenddiff --git a/spec/lib/backup_restore/database_restorer_spec.rb b/spec/lib/backup_restore/database_restorer_spec.rbindex 02666093b0a..9f1cc0c935b 100644--- a/spec/lib/backup_restore/database_restorer_spec.rb+++ b/spec/lib/backup_restore/database_restorer_spec.rb@@ -38,6 +38,7 @@ describe BackupRestore::DatabaseRestorer doDiscourse::Utils.expects(:execute_command).with do |env, command, options|env["SKIP_POST_DEPLOYMENT_MIGRATIONS"] == "0" &&env["SKIP_OPTIMIZE_ICONS"] == "1" &&+ env["DISABLE_TRANSLATION_OVERRIDES"] == "1" &&command == "rake db:migrate" &&options[:chdir] == Rails.rootend.once