Tweak error messages for restore

This commit is contained in:
Jay Pfaffman 2017-10-03 14:09:32 -07:00
parent 2ce6e0bb07
commit ab12c40e76
1 changed files with 9 additions and 2 deletions

View File

@ -87,11 +87,17 @@ class DiscourseCLI < Thor
desc "restore", "Restore a Discourse backup" desc "restore", "Restore a Discourse backup"
def restore(filename = nil) def restore(filename = nil)
if File.exist?('/usr/local/bin/discourse')
discourse = 'discourse'
else
discourse = './script/discourse'
end
if !filename if !filename
puts "You must provide a filename to restore. Did you mean one of the following?\n\n" puts "You must provide a filename to restore. Did you mean one of the following?\n\n"
Dir["public/backups/default/*"].each do |f| Dir["public/backups/default/*"].each do |f|
puts "discourse restore #{File.basename(f)}" puts "#{discourse} restore #{File.basename(f)}"
end end
return return
@ -110,7 +116,8 @@ class DiscourseCLI < Thor
puts '', 'The filename argument was missing.', '' puts '', 'The filename argument was missing.', ''
usage usage
rescue BackupRestore::RestoreDisabledError rescue BackupRestore::RestoreDisabledError
puts '', 'Restores are not allowed.', 'An admin needs to set allow_restore to true in the site settings before restores can be run.', '' puts '', 'Restores are not allowed.', 'An admin needs to set allow_restore to true in the site settings before restores can be run.'
puts "Enable now with", '', "#{discourse} enable_restore", ''
puts 'Restore cancelled.', '' puts 'Restore cancelled.', ''
end end