From ab12c40e76b7c29a2fae49a2edad459f3c0ced47 Mon Sep 17 00:00:00 2001 From: Jay Pfaffman Date: Tue, 3 Oct 2017 14:09:32 -0700 Subject: [PATCH] Tweak error messages for restore --- script/discourse | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/script/discourse b/script/discourse index 9013c87b798..c5d16d36e39 100755 --- a/script/discourse +++ b/script/discourse @@ -87,11 +87,17 @@ class DiscourseCLI < Thor desc "restore", "Restore a Discourse backup" def restore(filename = nil) + if File.exist?('/usr/local/bin/discourse') + discourse = 'discourse' + else + discourse = './script/discourse' + end + if !filename puts "You must provide a filename to restore. Did you mean one of the following?\n\n" Dir["public/backups/default/*"].each do |f| - puts "discourse restore #{File.basename(f)}" + puts "#{discourse} restore #{File.basename(f)}" end return @@ -110,7 +116,8 @@ class DiscourseCLI < Thor puts '', 'The filename argument was missing.', '' usage 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.', '' end