3 # Delete selected modules from webmin, after asking first
5 require './webmin-lib.pl';
7 &error_setup($text{'delete_err'});
8 @mods = split(/\0/, $in{'mod'});
9 @mods || &error($text{'delete_enone'});
11 # check if any other module depends on those to be deleted
12 foreach $minfo (&get_all_module_infos()) {
13 if (&check_os_support($minfo) && &indexof($minfo->{'dir'}, @mods) < 0) {
14 foreach $d (split(/\s+/, $minfo->{'depends'})) {
15 if (&indexof($minfo->{'dir'}, @mods) < 0) {
16 $depends{$d} = $minfo->{'desc'};
22 %minfo = &get_module_info($m);
23 %minfo = &get_theme_info($m) if (!%minfo);
24 if (!$in{'nodeps'} && !-l &module_root_directory($m) && $depends{$m}) {
25 &error(&text('delete_edep', "<tt>$minfo{'desc'}</tt>",
26 "<tt>$depends{$m}</tt>"));
30 # ask the user if he is sure
31 if (!$in{'confirm'}) {
32 &ui_print_header(undef, $text{'delete_title'}, "");
33 print "<p><form action=delete_mod.cgi>\n";
35 my %minfo = &get_module_info($m);
41 %minfo = &get_theme_info($m);
43 print "<input type=hidden name=mod value=$m>\n";
44 $total += &disk_usage_kb(&module_root_directory($m))
45 if (!-l &module_root_directory($m));
46 $descs .= " , " if ($descs);
47 $descs .= "<b>$minfo{'desc'}</b>";
49 print "<center>",&text($theme ? 'delete_rusure2' :
50 $total ? 'delete_rusure' : 'delete_rusure3',
51 int($total), $descs),"<p>",
52 "<input type=submit name=confirm value='$text{'delete'}'><br>\n";
53 print "<input type=checkbox name=acls value=1> $text{'delete_acls'}\n"
55 print &ui_hidden("nodeps", $in{'nodeps'}),"\n";
56 print "</form></center>\n";
57 &ui_print_footer("", $text{'index_return'});
61 # delete the selected modules or themes
62 foreach $m (split(/\0/, $in{'mod'})) {
63 next if (!$m || !-d &module_root_directory($m));
64 push(@mdesc, &delete_webmin_module($m, $in{'acls'}));
66 &flush_webmin_caches();
68 &ui_print_header(undef, $text{'delete_title'}, "");
69 print $text{'delete_msg'},"<p>\n";
71 for($i=0; $i<@mdesc; $i++) {
72 print $mdesc[$i],"<p>\n";
76 if (defined(&theme_post_change_modules)) {
77 &theme_post_change_modules();
80 &ui_print_footer("", $text{'index_return'});