This commit is contained in:
Your Name
2025-05-05 21:43:07 +12:00
parent 63490d9ce3
commit 1776a7e45f
3 changed files with 42 additions and 27 deletions

View File

@ -491,6 +491,12 @@ bool service_runner::restore(std::string backup_file, bool silent)
}
std::string local_backups_dir = gConfig().get_local_backup_path();
if (backup_file == "latest") {
// get the latest backup file from the server
backup_file = get_latest_backup_file(mServer, mService);
}
std::string local_backup_file_path = (std::filesystem::path(local_backups_dir) / backup_file).string();
if (! std::filesystem::exists(local_backup_file_path)) {
@ -520,14 +526,6 @@ bool service_runner::restore(std::string backup_file, bool silent)
std::cout << "Restoring " << nicedate << " backup of " << backup_template_name << " taken from "<<backup_server_name<<", onto "<<mServer<<"/"<<mService<<std::endl;
std::cout << std::endl;
std::cout << "*** ALL DATA FOR "<<mServer<<"/"<<mService<<" WILL BE OVERWRITTEN! ***"<<std::endl;
std::cout << std::endl;
std::cout << "Are you sure you want to continue? (y/n)" << std::endl;
char confirm;
std::cin >> confirm;
if (confirm != 'y') {
std::cout << "Restore cancelled." << std::endl;
return false;
}
// run the restore script
std::cout << "OK, here goes..." << std::endl;