]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fixed error in awstats_updateall.pl when current directory, while running it, is...
authoreldy <>
Mon, 5 Jan 2004 07:02:15 +0000 (07:02 +0000)
committereldy <>
Mon, 5 Jan 2004 07:02:15 +0000 (07:02 +0000)
docs/awstats_changelog.txt
tools/awstats_updateall.pl

index 3767215a6034c907a72c0d66470a83d184bff5f4..795a28b01a98ad1966d4596e87b63717e2ae93f2 100644 (file)
@@ -34,6 +34,8 @@ Fixes:
 - Fixed not working link for search keywords/keyphrase in menu with FireBird.
 - Fixed pb in loading plugins with mod_perl2.
 - Fixed not found relative DirData path with some Perl/OS versions.
+- Fixed error in awstats_updateall.pl when current directory, while running
+  it, is where awstats.pl is stored.
 
 New features/improvements:
 - Increased speed by 10 to 20%.
index dca7d63352ee59a29afddc625f2155d3704d0bab..34dd0eb66eb8299d7790f6934e129c590f8efb55 100644 (file)
@@ -15,8 +15,12 @@ my $VERSION="1.0 (build $REVISION)";
 # Default value of DIRCONFIG
 my $DIRCONFIG = "/etc/awstats";
 
+my $Debug=0;
+
 my $Awstats='awstats.pl';
+
 my $AwstatsDir='';
+my $AwstatsProg='';
 
 
 
@@ -64,6 +68,7 @@ for (0..@ARGV-1) {
        if ($ARGV[$_] =~ /^-*h/i)                        { $helpfound=1; last; }
        if ($ARGV[$_] =~ /^-*awstatsprog=(.*)/i) { $Awstats="$1"; next; }
        if ($ARGV[$_] =~ /^-*configdir=(.*)/i)   { $DIRCONFIG="$1"; next; }
+       if ($ARGV[$_] =~ /^-*debug=(\d+)/i)      { $debug=$1; next; }
        if ($ARGV[$_] =~ /^now/i)                        { $nowfound=1; next; }
 }
 
@@ -103,15 +108,18 @@ if (@files) {
                error("Can't find AWStats program ('$Awstats').\nUse -awstatsprog option to solve this");
                exit 1;
        }
-       $AwstatsDir=$Awstats; $AwstatsDir =~ s/[\\\/][^\\\/]*$//;
+       # Define AwstatsDir and AwstatsProg
+       ($AwstatsDir=$Awstats) =~ s/([^\/\\]+)$//; $AwstatsProg=$1;
+       $AwstatsDir||='.'; $AwstatsDir =~ s/([^\/\\])[\\\/]+$/$1/;
        debug("AwstatsDir=$AwstatsDir");
+       debug("AwstatsProg=$AwstatsProg");
 
        foreach (@files) {
                if ($_ =~ /^awstats\.(.*)conf$/) {
                        my $domain = $1||"default"; $domain =~ s/\.$//;
                        if ($domain eq 'model') { next; }
                        # Define command line
-                       my $command="\"$Awstats\" -update -config=$domain";
+                       my $command="\"$AwstatsDir/$AwstatsProg\" -update -config=$domain";
                        $command.=" -configdir=\"$DIRCONFIG\"";
                        # Run command line
                        print "Running '$command' to update config $domain\n";