Handle hostnames with upper-case letters
[webmin.git] / apache / save_mods.cgi
1 #!/usr/local/bin/perl
2 # Enable or disable Apache modules
3
4 require './apache-lib.pl';
5 &ReadParse();
6 $access{'global'} == 1 || &error($text{'mods_ecannot'});
7 &error_setup($text{'mods_err'});
8
9 @mods = &list_configured_apache_modules();
10 %want = map { $_, 1 } split(/\0/, $in{'m'});
11 $changed = 0;
12 foreach $m (@mods) {
13         if ($want{$m->{'mod'}} && !$m->{'enabled'}) {
14                 # Need to enable
15                 &add_configured_apache_module($m->{'mod'});
16                 $changed++;
17                 }
18         elsif (!$want{$m->{'mod'}} && $m->{'enabled'}) {
19                 # Need to disable
20                 &remove_configured_apache_module($m->{'mod'});
21                 $changed++;
22                 }
23         }
24
25 # Force re-detection of modules
26 unlink($site_file);
27
28 # Force restart Apache
29 if ($changed && &is_apache_running()) {
30         $err = &stop_apache();
31         &error($err) if ($err);
32         &wait_for_apache_stop();
33         $err = &start_apache();
34         &error($err) if ($err);
35         }
36
37 &webmin_log("mods");
38
39 &redirect("");
40
41