46
46
eval('use Win32::TieRegistry ( Delimiter=>"/", TiedRef=>\$reg )');
48
48
use vars qw/ $REVISION $VERSION /;
49
$REVISION='$Revision: 1.7 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
49
$REVISION='$Revision: 1.8 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
50
50
$VERSION="1.0 (build $REVISION)";
460
460
my $awstatsiconsfound=0;
461
461
my $awstatscgifound=0;
462
462
my $awstatsdirectoryfound=0;
464
if ($_ =~ /^CustomLog\s(.*)\scommon$/i) {
465
if ($_ =~ /^\s*CustomLog\s(.*)\scommon$/i)
465
467
print "Warning: You Apache config file contains directives to write 'common' log files\n";
466
468
print "This means that some features can't work (os, browsers and keywords detection).\n";
467
469
print "Do you want me to setup Apache to write 'combined' log files [y/N] ? ";
478
if ($_ =~ /^CustomLog\s(.*)\scombined$/i) { $LogFormat{$key}=1; }
480
if ($_ =~ /^\s*CustomLog\s(.*)\scombined$/i) { $LogFormat{$key}=1; }
479
481
if ($_ =~ /Alias \/awstatsclasses/) { $awstatsclassesfound=1; }
480
482
if ($_ =~ /Alias \/awstatscss/) { $awstatscssfound=1; }
481
483
if ($_ =~ /Alias \/awstatsicons/) { $awstatsiconsfound=1; }
488
if ($awstatsclassesfound && $awstatscssfound && $awstatsiconsfound && $awstatscgifound && $awstatsdirectoryfound) {
490
if ($awstatsclassesfound && $awstatscssfound && $awstatsiconsfound && $awstatscgifound && $awstatsdirectoryfound)
490
493
if ($commonchangedtocombined) { print " Common log files changed to combined.\n"; }
491
print " AWStats directives already present.\n";
494
print " All AWStats directives are already present.\n";
493
} elsif (!$commonchangedtocombined) {
497
498
# Add awstats directives
498
499
open(CONF,">>$key") || error("Failed to open config file '$key' for adding AWStats directives");
500
if (! $awstatsclassesfound || ! $awstatscssfound || ! $awstatsiconsfound || ! $awstatscgifound) {
503
print CONF "# Directives to allow use of AWStats as a CGI$CR\n";
506
if (! $awstatsclassesfound) {
507
print " Add 'Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"'\n";
508
print CONF "Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"$CR\n";
510
if (! $awstatscssfound) {
511
print " Add 'Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"'\n";
512
print CONF "Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"$CR\n";
514
if (! $awstatsiconsfound) {
515
print " Add 'Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"'\n";
516
print CONF "Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"$CR\n";
518
if (! $awstatscgifound) {
519
print " Add 'ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"'\n";
520
print CONF "ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"$CR\n";
522
if (! $awstatsdirectoryfound) {
523
print " Add '<Directory>' directive\n";
501
if (! $awstatsclassesfound || ! $awstatscssfound || ! $awstatsiconsfound || ! $awstatscgifound) {
504
print CONF "# Directives to allow use of AWStats as a CGI$CR\n";
507
if (! $awstatsclassesfound) {
508
print " Add 'Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"'\n";
509
print CONF "Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"$CR\n";
511
if (! $awstatscssfound) {
512
print " Add 'Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"'\n";
513
print CONF "Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"$CR\n";
515
if (! $awstatsiconsfound) {
516
print " Add 'Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"'\n";
517
print CONF "Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"$CR\n";
519
if (! $awstatscgifound) {
520
print " Add 'ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"'\n";
521
print CONF "ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"$CR\n";
523
if (! $awstatsdirectoryfound) {
524
print " Add '<Directory>' directive\n";
525
526
print CONF <<EOF;
527
528
# This is to permit URL access to scripts/files in AWStats directory.