mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FEATURE: Allow overriding the backup location when restoring via CLI (#12015)
You can use `discourse restore --location=local FILENAME` if you want to restore a backup that is stored locally even though the `backup_location` has the value `s3`.
This commit is contained in:
parent
b3fa521bf4
commit
4d719725c8
6 changed files with 28 additions and 10 deletions
|
@ -108,6 +108,7 @@ class DiscourseCLI < Thor
|
|||
|
||||
desc "restore", "Restore a Discourse backup"
|
||||
option :disable_emails, type: :boolean, default: true
|
||||
option :location, type: :string, enum: ["local", "s3"], desc: "Override the backup location"
|
||||
def restore(filename = nil)
|
||||
|
||||
if File.exist?('/usr/local/bin/discourse')
|
||||
|
@ -124,7 +125,7 @@ class DiscourseCLI < Thor
|
|||
if !filename
|
||||
puts "You must provide a filename to restore. Did you mean one of the following?\n\n"
|
||||
|
||||
store = BackupRestore::BackupStore.create
|
||||
store = BackupRestore::BackupStore.create(location: options[:location])
|
||||
store.files.each do |file|
|
||||
puts "#{discourse} restore #{file.filename}"
|
||||
end
|
||||
|
@ -138,6 +139,7 @@ class DiscourseCLI < Thor
|
|||
user_id: Discourse.system_user.id,
|
||||
filename: filename,
|
||||
disable_emails: options[:disable_emails],
|
||||
location: options[:location],
|
||||
factory: BackupRestore::Factory.new(user_id: Discourse.system_user.id)
|
||||
)
|
||||
restorer.run
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue