3 # Find and install modules that need updating
5 require './webmin-lib.pl';
7 &error_setup($text{'update_err'});
9 # Display the results and maybe take action
12 &ui_print_header(undef, $text{'update_title'}, "");
14 print "<b>",&text('update_info'),"</b><p>\n";
17 @urls = $in{'source'} == 0 ? ( $update_url ) : split(/\r?\n/, $in{'other'});
19 foreach $url (@urls) {
20 # Get updates from this URL, and filter to those for this system
21 $checksig = $in{'checksig'} ? 2 : $url eq $update_url ? 2 : 1;
22 ($updates, $host, $port, $page, $ssl) =
23 &fetch_updates($url, $in{'upuser'}, $in{'uppass'}, $checksig);
24 $updates = &filter_updates($updates, undef,
25 $in{'third'}, $in{'missing'});
26 $count += scalar(@$updates);
27 foreach $u (@$updates) {
28 # Get module or theme's details
29 my %minfo = &get_module_info($u->[0]);
30 my %tinfo = &get_theme_info($u->[0]);
31 my %info = %minfo ? %minfo : %tinfo;
34 # Just tell the user what would be done
35 print &text('update_mshow', "<b>$u->[0]</b>", "<b>$u->[1]</b>"),
38 print "$text{'update_fixes'} : " if ($info{'longdesc'});
39 print $u->[4],"<p>\n";
40 $donemodule{$u->[0]} = 1;
43 # Actually do the update ..
44 my (@mdescs, @mdirs, @msizes);
45 print &text('update_mok', "<b>$u->[0]</b>", "<b>$u->[1]</b>"),
48 print "$text{'update_fixes'} : " if ($info{'longdesc'});
49 print $u->[4],"<br>\n";
50 ($mhost, $mport, $mpage, $mssl) =
51 &parse_http_url($u->[2], $host, $port, $page, $ssl);
52 ($mfile = $mpage) =~ s/^(.*)\///;
53 $mtemp = &transname($mfile);
54 $progress_callback_url = $u->[2];
55 $progress_callback_prefix = " " x 10;
56 &http_download($mhost, $mport, $mpage, $mtemp, undef,
57 \&progress_callback, $mssl,
58 $in{'upuser'}, $in{'uppass'});
59 $irv = &check_update_signature($mhost, $mport, $mpage,
60 $mssl, $in{'upuser'}, $in{'uppass'},
62 $irv ||= &install_webmin_module($mtemp, 1, 0,
63 [ $base_remote_user ]);
66 print &text('update_failed', $irv),"<p>\n";
69 print &text('update_mdesc', "<b>$irv->[0]->[0]</b>",
70 "<b>$irv->[2]->[0]</b>"),"<p>\n";
71 $donemodule{$irv->[0]->[0]} = 1;
76 print &text('update_none'),"<br>\n" if (!$count);
78 # Check if a new version of webmin itself is available
79 $version = &get_latest_webmin_version();
80 if ($version > &get_webmin_version()) {
81 print "<b>",&text('update_version', $version),"</b><p>\n";
84 &ui_print_footer("", $text{'index_return'});