FIX: clear theme cache when restoring

Previously old themes may be cached incorrectly, this also forces
a rebake of old themes to ensure version can compile cleanly
This commit is contained in:
Sam 2018-11-20 13:37:58 +11:00
parent d1e50b3f8e
commit 1b4f2029d7
1 changed files with 16 additions and 19 deletions

View File

@ -59,39 +59,27 @@ module BackupRestore
if !can_restore_into_different_schema?
log "Cannot restore into different schema, restoring in-place"
enable_readonly_mode
pause_sidekiq
wait_for_sidekiq
BackupRestore.move_tables_between_schemas("public", "backup")
@db_was_changed = true
restore_dump
migrate_database
reconnect_database
reload_site_settings
clear_emoji_cache
disable_readonly_mode
else
log "Restoring into 'backup' schema"
restore_dump
enable_readonly_mode
pause_sidekiq
wait_for_sidekiq
switch_schema!
migrate_database
reconnect_database
reload_site_settings
clear_emoji_cache
disable_readonly_mode
end
migrate_database
reconnect_database
reload_site_settings
clear_emoji_cache
disable_readonly_mode
clear_theme_cache
extract_uploads
rescue SystemExit
log "Restore process was cancelled!"
@ -489,6 +477,15 @@ module BackupRestore
log "Something went wrong while unpausing Sidekiq.", ex
end
def clear_theme_cache
log "Clear theme cache"
ThemeField.all.each do |field|
field.compiler_version = 0
field.ensure_baked!
end
Theme.expire_site_cache!
end
def disable_readonly_mode
return if @readonly_mode_was_enabled
log "Disabling readonly mode..."