#!/usr/local/bin/perl
# restore.cgi
# Restore a backup dump

require './fsdump-lib.pl';
&ReadParse();
&error_setup($text{'restore_err'});

$cmd = &parse_restore($in{'fs'});

$theme_no_table++;
&header($text{'restore_title'}, "");
print "<hr>\n";

print "<b>",&text('restore_now', "<tt>$cmd</tt>"),"</b> <p>\n";
print "<pre>";
$rv = &restore_backup($in{'fs'}, $cmd);
print "</pre>\n";
if ($rv) {
	print "<b>",&text('restore_failed', $rv),"</b><p>\n";
	}
elsif (!$in{'test'}) {
	print "<b>$text{'restore_complete'}</b><p>\n";
	}
&webmin_log("restore", undef, $in{'mode'} == 0 ? $in{'file'} :
		      $in{'huser'} ? "$in{'huser'}@$in{'host'}:$in{'hfile'}" :
				     "$in{'huser'}:$in{'hfile'}");

print "<hr>\n";
&footer("", $text{'index_return'});

