"; $h = &open_console(); # Clear messages &console_cmd($h, "messages"); # Start the restore process &sysprint($h->{'infh'}, "restore client=$client jobid=$job storage=$in{'storage'}".($in{'where_def'} ? "" : " where=\"$in{'where'}\"")."\n"); &wait_for($h->{'outfh'}, 'restore.*\n'); print $wait_for_input; $rv = &wait_for($h->{'outfh'}, 'Enter\s+"done".*\n', 'Unable to get Job record', 'all the files'); print $wait_for_input; if ($rv == 1) { &job_error($text{'restore_ejob'}); } elsif ($rv == 2) { &job_error($text{'restore_ejobfiles'}); } # Select the files &wait_for($h->{'outfh'}, "\\\$"); # Wait for first prompt print $wait_for_input; foreach $f (@files) { $f = &unix_to_dos($f); if ($f eq "/") { &sysprint($h->{'infh'}, "cd /\n"); &wait_for($h->{'outfh'}, "\\\$"); print $wait_for_input; &sysprint($h->{'infh'}, "mark *\n"); &wait_for($h->{'outfh'}, "\\\$"); print $wait_for_input; } elsif ($f =~ /^(.*)\/([^\/]+)\/?$/) { local ($fd, $ff) = ($1, $2); $fd ||= "/"; &sysprint($h->{'infh'}, "cd \"$fd\"\n"); &wait_for($h->{'outfh'}, "\\\$"); print $wait_for_input; &sysprint($h->{'infh'}, "mark \"$ff\"\n"); &wait_for($h->{'outfh'}, "\\\$"); print $wait_for_input; } } &sysprint($h->{'infh'}, "done\n"); $rv = &wait_for($h->{'outfh'}, 'OK to run.*:', 'no files selected', 'Select Restore Job.*:'); print $wait_for_input; if ($rv == 0) { &sysprint($h->{'infh'}, "yes\n"); } elsif ($rv == 1) { &job_error($text{'restore_enofiles'}); } elsif ($rv == 2) { &sysprint($h->{'infh'}, "1\n"); &wait_for($h->{'outfh'}, 'OK to run.*:'); &sysprint($h->{'infh'}, "yes\n"); } else { &job_error($text{'backup_eok'}); } print "
"; while(1) { $out = &console_cmd($h, "messages"); if ($out !~ /You\s+have\s+no\s+messages/i) { print $out; } if ($out =~ /Termination:\s+(.*)/) { $status = $1; last; } sleep(1); } print "
\n"; } else { print "",$text{'restore_failed'},"
\n"; } } else { # Let it fly print "",$text{'restore_running2'},"
\n"; } &close_console($h); } &webmin_log("restore", $in{'job'}); &ui_print_footer("restore_form.cgi", $text{'restore_return'}); sub job_error { &close_console($h); print "\n"; print "",@_,"
\n"; &ui_print_footer("backup_form.cgi", $text{'backup_return'}); exit; }