FIX: Make sure constant reflects the right backup extenstion.

This commit is contained in:
Guo Xiang Tan 2016-08-24 10:28:23 +08:00
parent e4c5cb84cd
commit 5b3cbd3c9d
3 changed files with 5 additions and 4 deletions

View File

@ -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"

View File

@ -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}")

View File

@ -116,9 +116,9 @@ module BackupRestore
@dump_filename =
if @is_archive
if system('tar', '--list', '--file', @source_filename, BackupRestore::OLD_DUMP_FILE)
File.join(@tmp_directory, BackupRestore::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)