index.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. ob_start();
  4. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  5. // Check token
  6. verify_csrf($_GET);
  7. $snapshot = quoteshellarg($_GET["snapshot"]);
  8. if (empty($_GET["object"])) {
  9. $_GET["object"] = "";
  10. }
  11. if (empty($_GET["type"])) {
  12. exec(
  13. HESTIA_CMD . "v-schedule-user-restore-restic " . $user . " " . $snapshot,
  14. $output,
  15. $return_var,
  16. );
  17. if ($return_var == 0) {
  18. $_SESSION["error_msg"] = _(
  19. "Task has been added to the queue. You will receive an email notification when your restore has been completed.",
  20. );
  21. } else {
  22. $_SESSION["error_msg"] = implode("<br>", $output);
  23. if (empty($_SESSION["error_msg"])) {
  24. $_SESSION["error_msg"] = _("Error: Hestia did not return any output.");
  25. }
  26. if ($return_var == 4) {
  27. $_SESSION["error_msg"] = _(
  28. "An existing restoration task is already running. Please wait for it to finish before launching it again.",
  29. );
  30. }
  31. }
  32. } else {
  33. exec(
  34. HESTIA_CMD .
  35. "v-schedule-user-restore-restic " .
  36. $user .
  37. " " .
  38. $snapshot .
  39. " " .
  40. quoteshellarg($_GET["type"]) .
  41. " " .
  42. quoteshellarg($_GET["object"]),
  43. $output,
  44. $return_var,
  45. );
  46. }
  47. header("Location: /list/backup/incremental/?snapshot=" . $_GET["snapshot"]);