diff options
Diffstat (limited to 'web_wizard/scripts/Webconf.pm')
-rw-r--r-- | web_wizard/scripts/Webconf.pm | 36 |
1 files changed, 32 insertions, 4 deletions
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 (<FH>) { + 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*<Directory \/home/s...m/^\s*<\/Directory>/s ) { - { s /^\s*Allow .*$/ Allow from $that\n/s;} - ;} - if( m /^\s*<Directory \/var\/www/s...m/^\s*<\/Directory>/s ) { + if( m /^\s*<Directory.*>/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; } |