diff options
Diffstat (limited to 'web_wizard/Apache.pm')
-rwxr-xr-x | web_wizard/Apache.pm | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm index 91095ea2..05b20ea2 100755 --- a/web_wizard/Apache.pm +++ b/web_wizard/Apache.pm @@ -41,8 +41,24 @@ my $o = { user_dir => '', shared_dir => '' }, - needed_rpm => [ ( $config->{ver} == 2 ? 'apache2' : 'apache') ], - defaultimage => "$ENV{__WIZARD_HOME__}web_wizard/images/apache.png" + needed_rpm => '', + defaultimage => "$ENV{__WIZ_HOME__}web_wizard/images/apache.png", + init => sub { + if (-f $file) { + open my $FH, $file or die "$! ($file)"; + while (<$FH>) { + if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { + close($FH); + $root = $1; + last; + } + } + close($FH); + } else { + return (0, N("%s does not exist.", $file)) + } +} + }; $o->{pages} = { @@ -63,7 +79,7 @@ $o->{pages} = { dhcp_warning => { name => N('Warning.'), data => [ { label => N('You are in dhcp, server may not work with your configuration.') } ], - next => 'summary' + next => 'config' }, ask_mod => { name => N('Modules :') . "\n\n" . N('* User module : allows users to have a directory in their home directories available on your http server via http://www.yourserver.com/~user, you will be asked for the name of this directory afterward.'), @@ -131,20 +147,13 @@ available on your http server via http://www.yourserver.com/~user.'), type => 'b sub new { my ($class, $conf) = @_; $config = $conf; - $file = $config->{ver} == 2 ? "/etc/httpd/conf/httpd2.conf" : "/etc/httpd/conf/httpd.conf"; - if (-f $file) { - open my $FH, $file or die "$! ($file)"; - while (<$FH>) { - if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { - close($FH); - $root = $1; - last; - } - } - close($FH); + if ($config->{ver} == 2) { + $file = "/etc/httpd/conf/httpd2.conf"; + $o->{needed_rpm} = [ 'apache2' ] } else { - return (0, N("%s does not exist.", $file)) - } + $file = "/etc/httpd/conf/httpd.conf"; + $o->{needed_rpm} = [ 'apache' ] + } bless { o => $o, }, $class; @@ -215,7 +224,7 @@ sub do_it { $that = "all"; } elsif ($o->{var}{web_internal} eq "1") { - ($that) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; + ($that) = $wiz->{net}->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/; $that .= " 127.0.0.1"; } cp_af($file, $file.".orig"); |