From: eldy <>
Date: Sun, 23 Sep 2001 15:11:21 +0000 (+0000)
Subject: Add a warning if save of history file failed.
X-Git-Tag: AWSTATS_1_0~111
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eb5326290b7cd1c9cd6fb5ee6b19fb31d43cf84;p=thirdparty%2FAWStats.git
Add a warning if save of history file failed.
---
diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl
index 823c0073..520e454d 100644
--- a/wwwroot/cgi-bin/awstats.pl
+++ b/wwwroot/cgi-bin/awstats.pl
@@ -77,7 +77,7 @@ $found, $internal_link) = ();
%MonthBytes = %MonthHits = %MonthHostsKnown = %MonthHostsUnknown = %MonthPages = %MonthUnique = %MonthVisits =
%monthlib = %monthnum = ();
-$VERSION="3.2 (build 5)";
+$VERSION="3.2 (build 6)";
$Lang="en";
# Default value
@@ -933,8 +933,14 @@ sub error {
sub warning {
if ($WarningMessages == 1) {
- print "$_[0]
\n";
- #print "You can now remove this warning by changing \$WarningMessages=1 parameter into \$WarningMessages=0 in $PROG config file ($FileConfig).
\n"; }
+ my $messagestring=$_[0];
+ if ($ENV{"GATEWAY_INTERFACE"} ne "") {
+ $messagestring =~ s/\n/\
/g;
+ print "$messagestring
\n";
+ }
+ else {
+ print "$messagestring\n";
+ }
}
}
@@ -1996,7 +2002,7 @@ if ($ENV{"GATEWAY_INTERFACE"} ne "") { $DirCgi=""; }
if (($DirCgi ne "") && !($DirCgi =~ /\/$/) && !($DirCgi =~ /\\$/)) { $DirCgi .= "/"; }
if ($DirData eq "" || $DirData eq ".") { $DirData=$DIR; } # If not defined or chosen to "." value then DirData is current dir
if ($DirData eq "") { $DirData="."; } # If current dir not defined then we put it to "."
-$DirData =~ s/\/$//;
+$DirData =~ s/\/$//; $DirData =~ s/\\$//;
$SiteToAnalyze=$SiteDomain;
if ($SiteToAnalyze eq "") { $SiteToAnalyze=$SiteConfig; }
$SiteToAnalyze =~ tr/A-Z/a-z/;
@@ -2670,6 +2676,9 @@ if ($UpdateStats) {
if (-s "$DirData/$PROG$1$FileSuffix.tmp.$$") { # Rename files of this session with size > 0
if (rename("$DirData/$PROG$1$FileSuffix.tmp.$$", "$DirData/$PROG$1$FileSuffix.txt")==0) {
$allok=0; # At least one error in renaming working files
+ # Remove file
+ unlink "$DirData/$PROG$1$FileSuffix.tmp.$$";
+ warning("Warning: Failed to rename \"$DirData/$PROG$1$FileSuffix.tmp.$$\" into \"$DirData/$PROG$1$FileSuffix.txt\".\nWrite permissions on \"$PROG$1$FileSuffix.txt\" might be wrong".($ENV{"GATEWAY_INTERFACE"} ne ""?" for an 'update from web'":"")." or file might be opened.");
last;
}
chmod 0666,"$DirData/$PROG$1$FileSuffix.txt";