2 # Do an immediate restore
6 require './backup-config-lib.pl';
7 our (%in, %text, %config, $module_config_file);
11 &error_setup($text{'restore_err'});
12 my $src = &parse_backup_destination("src", \%in);
13 my @mods = split(/\0/, $in{'mods'});
14 @mods || &error($text{'restore_emods'});
17 my ($mode, $user, $pass, $server, $path, $port) = &parse_backup_url($src);
19 # Create temp file for uploaded file
20 my $temp = &transname();
22 print TEMP $in{$path};
26 &ui_print_header(undef, $text{'restore_title'}, "");
27 print &text($in{'test'} ? 'restore_testing' : 'restore_doing',
28 &nice_dest($src)),"<p>\n";
30 my $err = &execute_restore(\@mods, $src, \@files, $in{'apply'}, $in{'test'});
31 &unlink_file($src) if ($mode == 3);
33 print &text('restore_failed', $err),"<p>\n";
36 print $text{'restore_done2'},"<p>\n";
37 print &ui_table_start(undef, "width=100%", 2);
38 print &ui_table_row(undef,
39 "<pre>".join("\n", map { &html_escape($_) } @files)."</pre>", 2);
40 print &ui_table_end();
43 print &text('restore_done', scalar(@files)),"<p>\n";
45 $config{'apply'} = $in{'apply'};
46 &lock_file($module_config_file);
47 &save_module_config();
48 &unlock_file($module_config_file);
49 &webmin_log("restore", undef, $src, { 'mods' => \@mods });
50 &ui_print_footer("", $text{'index_return2'});