From: eldy <> Date: Fri, 19 Sep 2003 16:46:37 +0000 (+0000) Subject: Added the AllowFullYearView parameter. X-Git-Tag: AWSTATS_5_9_BETA~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65c812812db2c2075041ea4241709c94b8ee50ec;p=thirdparty%2FAWStats.git Added the AllowFullYearView parameter. --- diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index be828705..d970b41d 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -227,6 +227,21 @@ DirIcons="/icon" AllowToUpdateStatsFromBrowser=0 +# AWStats save and sort its database on a month basis, this allows to build +# build a report quickly. However, if you choose the -month=all from command +# lien or the month='---' from CGI form to have a report for all year, AWStats +# need to reload all data for full year, and resort them completely, requiring +# a large amount of memory and CPU. This might be a problem for web hosting +# providers that offer AWStats for large sites on shared servers to non CPU +# cautious customers. +# For this reason, the 'full year' is only enable on Command Line by default. +# You can change this by setting this parameter to 0, 1 or 2. +# Possible values: 0 (never allowed), 1 (on CLI only), 2 (on CLI and CGI) +# Default: 1 +# +AllowFullYearView=1 + + #----------------------------------------------------------------------------- # OPTIONAL SETUP SECTION (Not required but increase AWStats features) diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 1003743b..88fa42b2 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -147,7 +147,8 @@ $Expires, $UpdateStats, $MigrateStats, $URLNotCaseSensitive, $URLWithQuery, $URL $UseFramesWhenCGI, $DecodeUA)= (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); use vars qw/ -$AllowToUpdateStatsFromBrowser $ArchiveLogRecords $DetailedReportsOnNewWindows +$AllowToUpdateStatsFromBrowser $AllowFullYearView +$ArchiveLogRecords $DetailedReportsOnNewWindows $FirstDayOfWeek $KeyWordsNotSensitive $SaveDatabaseFilesWithPermissionsForEveryone $WarningMessages $DebugMessages $ShowLinksOnUrl $ShowMenu $ShowMonthStats $ShowDaysOfMonthStats $ShowDaysOfWeekStats @@ -157,7 +158,8 @@ $ShowOSStats $ShowBrowsersStats $ShowOriginStats $ShowKeyphrasesStats $ShowKeywordsStats $ShowMiscStats $ShowHTTPErrorsStats $AddDataArrayMonthStats $AddDataArrayShowDaysOfMonthStats $AddDataArrayShowDaysOfWeekStats $AddDataArrayShowHoursStats /; -($AllowToUpdateStatsFromBrowser, $ArchiveLogRecords, $DetailedReportsOnNewWindows, +($AllowToUpdateStatsFromBrowser, $AllowFullYearView, +$ArchiveLogRecords, $DetailedReportsOnNewWindows, $FirstDayOfWeek, $KeyWordsNotSensitive, $SaveDatabaseFilesWithPermissionsForEveryone, $WarningMessages, $DebugMessages, $ShowLinksOnUrl, $ShowMenu, $ShowMonthStats, $ShowDaysOfMonthStats, $ShowDaysOfWeekStats, @@ -167,7 +169,7 @@ $ShowOSStats, $ShowBrowsersStats, $ShowOriginStats, $ShowKeyphrasesStats, $ShowKeywordsStats, $ShowMiscStats, $ShowHTTPErrorsStats, $AddDataArrayMonthStats, $AddDataArrayShowDaysOfMonthStats, $AddDataArrayShowDaysOfWeekStats, $AddDataArrayShowHoursStats )= -(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); +(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); use vars qw/ $LevelForRobotsDetection $LevelForBrowsersDetection $LevelForOSDetection $LevelForRefererAnalyze $LevelForSearchEnginesDetection $LevelForKeywordsDetection @@ -1538,6 +1540,7 @@ sub Check_Config { if ($DNSLookup !~ /[0-2]/) { error("DNSLookup parameter is wrong in config/domain file. Value is '$DNSLookup' (should be 0 or 1)"); } if (! $SiteDomain) { error("SiteDomain parameter not defined in your config/domain file. You must add it for using this version of AWStats."); } if ($AllowToUpdateStatsFromBrowser !~ /[0-1]/) { $AllowToUpdateStatsFromBrowser=0; } + if ($AllowFullYearView !~ /[0-2]/) { $AllowFullYearView=1; } # Optional setup section if ($EnableLockForUpdate !~ /[0-1]/) { $EnableLockForUpdate=0; } $DNSStaticCacheFile||='dnscache.txt'; @@ -5151,7 +5154,7 @@ if ($QueryString =~ /(^|&)output(=[^&]*|)(&|$)/i) { if ($ENV{'GATEWAY_INTERFACE'} && ! scalar keys %HTMLOutput) { $HTMLOutput{'main'}=1; } # Remove -output option with no = from QueryString -$QueryString=~s/(^|&)output(&|$)//i; $QueryString=~s/&+$//; +$QueryString=~s/(^|&)output(&|$)/$1/i; $QueryString=~s/&+$//; # Check year and month parameters if ($QueryString =~ /(^|&)month=(year)/i) { error("month=year is a deprecated option. Use month=all instead."); } @@ -5385,6 +5388,11 @@ if ($AllowAccessFromWebToFollowingIPAddresses && $ENV{'GATEWAY_INTERFACE'}) { if (($UpdateStats || $MigrateStats) && (! $AllowToUpdateStatsFromBrowser) && $ENV{'GATEWAY_INTERFACE'}) { error("".($UpdateStats?"Update":"Migrate")." of statistics has not been allowed from a browser (AllowToUpdateStatsFromBrowser should be set to 1)."); } +if (scalar keys %HTMLOutput && $MonthRequired eq 'all') { + if (! $AllowFullYearView) { error("Full year view has not been allowed (AllowFullYearView is set to 0)."); } + if ($AllowFullYearView==1 && $ENV{'GATEWAY_INTERFACE'}) { error("Full year view has not been allowed from a browser (AllowFullYearView should be set to 2)."); } +} + #------------------------------------------ # MIGRATE PROCESS (Must be after reading config cause we need MaxNbOf... and Min...)