From a268005176ec34c26aacf9a53f720dbf4e325ae3 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Mon, 30 Sep 2002 13:46:19 +0000 Subject: added doc root field --- web_wizard/scripts/Webconf.pm | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'web_wizard/scripts') diff --git a/web_wizard/scripts/Webconf.pm b/web_wizard/scripts/Webconf.pm index 06a17fa5..cf9d9b55 100644 --- a/web_wizard/scripts/Webconf.pm +++ b/web_wizard/scripts/Webconf.pm @@ -15,6 +15,36 @@ sub check { 0; } +my $file = "/etc/httpd/conf/commonhttpd.conf"; +my $root; + +if (-f $file) { + open(FH, "< $file") or die "$! ($file)"; + while () { + if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { + close(FH); + $root = "$1"; + last; + } + } + close(FH); +} + +sub get_docroot { + $root; +} + +sub check_dir { + -d ($ENV{wiz_dir}) and return 10; + 1; +} + +sub chg_docroot { + substInFile { + s|(^\s*\#?\s*DocumentRoot\s*).*|$1$ENV{wiz_dir}|; + } "/etc/httpd/conf/commonhttpd.conf"; +} + sub do_it { my $file = "/etc/httpd/conf/commonhttpd.conf"; my $that = "localhost"; @@ -28,13 +58,11 @@ sub do_it { } cp_af($file, $file.".orig"); substInFile { - if( m /^\s*/s ) { - { s /^\s*Allow .*$/ Allow from $that\n/s;} - ;} - if( m /^\s*/s ) { + if( m /^\s*/s...m/^\s*<\/Directory>/s ) { { s /^\s*Allow .*$/ Allow from $that\n/s;} ;} } $file; +# chg_docroot(); system("/etc/rc.d/init.d/httpd restart"); 10; } -- cgit v1.2.1