From 3e4b02bbd47cb6ff63520905fc17461e3549fb58 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 24 Aug 2016 10:28:23 +0800 Subject: [PATCH] FIX: Make sure constant reflects the right backup extenstion. --- lib/backup_restore/backup_restore.rb | 3 ++- lib/backup_restore/backuper.rb | 2 +- lib/backup_restore/restorer.rb | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/backup_restore/backup_restore.rb b/lib/backup_restore/backup_restore.rb index af4670fb125..0b50e094fbd 100644 --- a/lib/backup_restore/backup_restore.rb +++ b/lib/backup_restore/backup_restore.rb @@ -7,7 +7,8 @@ module BackupRestore class OperationRunningError < RuntimeError; end VERSION_PREFIX = "v".freeze - DUMP_FILE = "dump.sql" + DUMP_FILE = "dump.sql.gz".freeze + OLD_DUMP_FILE = "dump.sql".freeze METADATA_FILE = "meta.json" LOGS_CHANNEL = "/admin/backups/logs" diff --git a/lib/backup_restore/backuper.rb b/lib/backup_restore/backuper.rb index 5c547b7545c..4d2e0c9f09f 100644 --- a/lib/backup_restore/backuper.rb +++ b/lib/backup_restore/backuper.rb @@ -81,7 +81,7 @@ module BackupRestore @current_db = RailsMultisite::ConnectionManagement.current_db @timestamp = Time.now.strftime("%Y-%m-%d-%H%M%S") @tmp_directory = File.join(Rails.root, "tmp", "backups", @current_db, @timestamp) - @dump_filename = "#{File.join(@tmp_directory, BackupRestore::DUMP_FILE)}.gz" + @dump_filename = File.join(@tmp_directory, BackupRestore::DUMP_FILE) @archive_directory = File.join(Rails.root, "public", "backups", @current_db) @archive_basename = File.join(@archive_directory, "#{SiteSetting.title.parameterize}-#{@timestamp}-#{BackupRestore::VERSION_PREFIX}#{BackupRestore.current_version}") diff --git a/lib/backup_restore/restorer.rb b/lib/backup_restore/restorer.rb index 1ea20415740..504fa9cc941 100644 --- a/lib/backup_restore/restorer.rb +++ b/lib/backup_restore/restorer.rb @@ -115,10 +115,10 @@ module BackupRestore # For backwards compatibility @dump_filename = if @is_archive - if system("tar --list --file #{@source_filename} #{BackupRestore::DUMP_FILE}") - File.join(@tmp_directory, BackupRestore::DUMP_FILE) + 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}.gz") + File.join(@tmp_directory, BackupRestore::DUMP_FILE) end else File.join(@tmp_directory, @filename)