FIX: Don't optimize icons during db:migrate when restoring backup
Uploads are extracted after the DB migration, so this could lead to a failure during the restore. Site icons get optimized after extracting uploads.
This commit is contained in:
parent
5c581b475a
commit
8fa8bab9ff
|
@ -134,7 +134,7 @@ module BackupRestore
|
||||||
log "Migrating the database..."
|
log "Migrating the database..."
|
||||||
|
|
||||||
log Discourse::Utils.execute_command(
|
log Discourse::Utils.execute_command(
|
||||||
{ "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0" },
|
{ "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "0", "SKIP_OPTIMIZE_ICONS" => "1" },
|
||||||
"rake db:migrate",
|
"rake db:migrate",
|
||||||
failure_message: "Failed to migrate database.",
|
failure_message: "Failed to migrate database.",
|
||||||
chdir: Rails.root
|
chdir: Rails.root
|
||||||
|
|
|
@ -77,7 +77,7 @@ task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args|
|
||||||
|
|
||||||
SeedFu.seed(DiscoursePluginRegistry.seed_paths)
|
SeedFu.seed(DiscoursePluginRegistry.seed_paths)
|
||||||
|
|
||||||
if !Discourse.skip_post_deployment_migrations?
|
if !Discourse.skip_post_deployment_migrations? && ENV['SKIP_OPTIMIZE_ICONS'] != '1'
|
||||||
puts
|
puts
|
||||||
print "Optimizing site icons... "
|
print "Optimizing site icons... "
|
||||||
SiteIconManager.ensure_optimized!
|
SiteIconManager.ensure_optimized!
|
||||||
|
|
|
@ -37,6 +37,7 @@ describe BackupRestore::DatabaseRestorer do
|
||||||
def expect_db_migrate
|
def expect_db_migrate
|
||||||
Discourse::Utils.expects(:execute_command).with do |env, command, options|
|
Discourse::Utils.expects(:execute_command).with do |env, command, options|
|
||||||
env["SKIP_POST_DEPLOYMENT_MIGRATIONS"] == "0" &&
|
env["SKIP_POST_DEPLOYMENT_MIGRATIONS"] == "0" &&
|
||||||
|
env["SKIP_OPTIMIZE_ICONS"] == "1" &&
|
||||||
command == "rake db:migrate" &&
|
command == "rake db:migrate" &&
|
||||||
options[:chdir] == Rails.root
|
options[:chdir] == Rails.root
|
||||||
end.once
|
end.once
|
||||||
|
|
Loading…
Reference in New Issue