diff --git a/lib/backup_restore/restorer.rb b/lib/backup_restore/restorer.rb index 039936119a0..9089c61b4b9 100644 --- a/lib/backup_restore/restorer.rb +++ b/lib/backup_restore/restorer.rb @@ -114,18 +114,6 @@ module BackupRestore @meta_filename = File.join(@tmp_directory, BackupRestore::METADATA_FILE) @is_archive = !(@filename =~ /.sql.gz$/) - # For backwards compatibility - @dump_filename = - if @is_archive - if system('tar', '--list', '--file', @source_filename, BackupRestore::OLD_DUMP_FILE) - File.join(@tmp_directory, BackupRestore::OLD_DUMP_FILE) - else - File.join(@tmp_directory, BackupRestore::DUMP_FILE) - end - else - File.join(@tmp_directory, @filename) - end - @logs = [] @readonly_mode_was_enabled = Discourse.readonly_mode? end @@ -195,7 +183,7 @@ module BackupRestore log "Extracting metadata file..." @metadata = - if system('tar', '--list', '--file', @source_filename, BackupRestore::METADATA_FILE) + if system('tar', '--list', '--file', @tar_filename, BackupRestore::METADATA_FILE) FileUtils.cd(@tmp_directory) do execute_command( 'tar', '--extract', '--file', @tar_filename, BackupRestore::METADATA_FILE, @@ -228,6 +216,18 @@ module BackupRestore end def extract_dump + @dump_filename = + if @is_archive + # For backwards compatibility + if system('tar', '--list', '--file', @tar_filename, BackupRestore::OLD_DUMP_FILE) + File.join(@tmp_directory, BackupRestore::OLD_DUMP_FILE) + else + File.join(@tmp_directory, BackupRestore::DUMP_FILE) + end + else + File.join(@tmp_directory, @filename) + end + return unless @is_archive log "Extracting dump file..."