From: eldy <> Date: Sun, 2 Mar 2003 04:12:44 +0000 (+0000) Subject: Group OS by families. Added a detailed OS version chart. X-Git-Tag: AWSTATS_5_5_BETA~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd16ac388f0e89d81844bd11415b8a3f48ea2dd1;p=thirdparty%2FAWStats.git Group OS by families. Added a detailed OS version chart. --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index c4e31a28..d0757c91 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -11,6 +11,7 @@ Fixes: New features/improvments: - Added a screen size report. +- Group OS by families. Added a detailed OS version chart. - Better 404 errors management. URLs are always cleaned from their parameter to build '404 not found' URLs list (because parameters are not interesting as they can't have effect as page is not found). Referrer diff --git a/tools/awstats_buildstaticpages.pl b/tools/awstats_buildstaticpages.pl index 478901fd..7cc533c9 100644 --- a/tools/awstats_buildstaticpages.pl +++ b/tools/awstats_buildstaticpages.pl @@ -43,7 +43,7 @@ my @OutputList=( "alllogins","lastlogins", "allrobots","lastrobots", "urldetail","urlentry","urlexit", -"unknownos","unknownbrowser","browserdetail", +"unknownos","unknownbrowser","osdetail","browserdetail", "refererse","refererpages", #"referersites", "keyphrases","keywords", diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index de2f01c9..f35538b2 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -230,7 +230,7 @@ use vars qw/ @_time_p = @_time_h = @_time_k = (); @fieldlib = @keylist = (); use vars qw/ -@BrowsersFamily @SessionsRange %SessionsAverage %LangBrowserToAwstats +@OSFamily @BrowsersFamily @SessionsRange %SessionsAverage %LangBrowserToAwstats @HostAliases @AllowAccessFromWebToFollowingAuthenticatedUsers @DefaultFile @SkipDNSLookupFor @SkipHosts @SkipUserAgents @SkipFiles @@ -242,6 +242,7 @@ use vars qw/ @ExtraFirstColumnValuesType @ExtraFirstColumnValuesTypeVal @PluginsToLoad /; +@OSFamily=('win','mac'); @BrowsersFamily=('msie','netscape'); @SessionsRange=('0s-30s','30s-2mn','2mn-5mn','5mn-15mn','15mn-30mn','30mn-1h','1h+'); %SessionsAverage=('0s-30s',15,'30s-2mn',75,'2mn-5mn',210,'5mn-15mn',600,'15mn-30mn',1350,'30mn-1h',2700,'1h+',3600); @@ -620,7 +621,7 @@ EOF sub html_end { if (scalar keys %HTMLOutput) { if ($FrameName ne 'index' && $FrameName ne 'mainleft') { - print "$Center


\n"; + print "$Center

\n"; print ""; print "Advanced Web Statistics $VERSION - Created by $PROG"; my $atleastoneplugin=0; @@ -631,8 +632,7 @@ sub html_end { } if ($atleastoneplugin) { print ")"; } print "
\n"; - print "
\n"; - print "$HTMLEndSection\n"; + if ($HTMLEndSection) { print "
\n$HTMLEndSection\n"; } } print "\n"; if ($FrameName ne 'index') { print "\n"; } @@ -659,7 +659,8 @@ sub tab_head { print "$title "; } print " \n"; - print ""; + print "
\n"; + print "\n"; } #------------------------------------------------------------------------------ @@ -1736,7 +1737,7 @@ sub Read_History_With_TmpUpdate { if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowSessionsStats) || $HTMLOutput{'sessions'}) { $SectionsToLoad{'session'}=$order++; } if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowPagesStats) || $HTMLOutput{'urldetail'} || $HTMLOutput{'urlentry'} || $HTMLOutput{'urlexit'}) { $SectionsToLoad{'sider'}=$order++; } if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowFileTypesStats) || $HTMLOutput{'filetypes'}) { $SectionsToLoad{'filetypes'}=$order++; } - if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowOSStats) || $HTMLOutput{'os'}) { $SectionsToLoad{'os'}=$order++; } + if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowOSStats) || $HTMLOutput{'osdetail'}) { $SectionsToLoad{'os'}=$order++; } if ($UpdateStats || $MigrateStats || ($HTMLOutput{'main'} && $ShowBrowsersStats) || $HTMLOutput{'browserdetail'}) { $SectionsToLoad{'browser'}=$order++; } if ($UpdateStats || $MigrateStats || $HTMLOutput{'unknownos'}) { $SectionsToLoad{'unknownreferer'}=$order++; } if ($UpdateStats || $MigrateStats || $HTMLOutput{'unknownbrowser'}) { $SectionsToLoad{'unknownrefererbrowser'}=$order++; } @@ -4660,6 +4661,7 @@ if ((! $ENV{'GATEWAY_INTERFACE'}) && (! $SiteConfig)) { print " urlentry:filter to list entry pages matching filter\n"; print " urlexit to list exit pages\n"; print " urlexit:filter to list exit pages matching filter\n"; + print " osdetail to build page with os detailed versions\n"; print " browserdetail to build page with browsers detailed versions\n"; print " unknownbrowser to list 'User Agents' with unknown browser\n"; print " unknownos to list 'User Agents' with unknown OS\n"; @@ -6102,7 +6104,7 @@ if (scalar keys %HTMLOutput) { if ($linetitle) { print "\n"; } if ($linetitle) { print ($frame?"\n":"\n":"   "); } - #if ($ShowMonthDayStats) { print ($frame?"\n":"   "); } + #if ($ShowMonthDayStats) { print ($frame?"\n":"   "); } if ($ShowDaysOfWeekStats) { print ($frame?"\n":"   "); } if ($ShowHoursStats) { print ($frame?"\n":"   "); } if ($linetitle) { print ($frame?"":"\n"); } @@ -6144,10 +6146,11 @@ if (scalar keys %HTMLOutput) { if ($ShowFileTypesStats) { print ($frame?"\n":"   "); } if ($ShowFileSizesStats) { } if ($ShowOSStats) { print ($frame?"\n":"   "); } - if ($ShowOSStats && $FrameName eq 'mainleft') { print ($frame?"\n":"   "); } + if ($ShowOSStats) { print ($frame?"\n":"   "); } + if ($ShowOSStats) { print ($frame?"\n":"   "); } if ($ShowBrowsersStats) { print ($frame?"\n":"   "); } if ($ShowBrowsersStats) { print ($frame?"\n":"   "); } - if ($ShowBrowsersStats && $FrameName eq 'mainleft') { print ($frame?"\n":"   "); } + if ($ShowBrowsersStats) { print ($frame?"\n":"   "); } if ($ShowScreenSizeStats) { print ($frame?"\n":"   "); } if ($linetitle) { print ($frame?"":"\n"); } # Referers @@ -6980,9 +6983,90 @@ if (scalar keys %HTMLOutput) { &tab_end; &html_end; } + if ($HTMLOutput{'osdetail'}) { + # Show os versions + print "$Center 
"; + my $title="$Message[59]"; + &tab_head("$title",19); + print ""; + print ""; + print ""; + print "\n"; + # Count Total by family + my %totalfamily_h=(); + my $Total=0; + my $count=0; + &BuildKeyList($MaxRowsInHTMLOutput,1,\%_os_h,\%_os_h); + my %keysinkeylist=(); + $max_h=1; + OSLOOP: foreach my $key (@keylist) { + $Total+=$_os_h{$key}; + if ($_os_h{$key} > $max_h) { $max_h = $_os_h{$key}; } + foreach my $family (@OSFamily) { if ($key =~ /^$family/i) { $totalfamily_h{$family}+=$_os_h{$key}; next OSLOOP; } } + } + # Write records grouped in a brwoser family + foreach my $family (@OSFamily) { + my $p=' '; + if ($Total) { $p=int($totalfamily_h{$family}/$Total*1000)/10; $p="$p %"; } + print ""; + print ""; + print "\n"; + foreach my $key (reverse sort keys %_os_h) { + if ($key =~ /^$family(.*)/i) { + $keysinkeylist{$key}=1; + my $ver=$1; + my $p=' '; + if ($Total) { $p=int($_os_h{$key}/$Total*1000)/10; $p="$p %"; } + print ""; + print "\"\""; + print ""; + my $bredde_h=0; + if ($max_h > 0) { $bredde_h=int($BarWidth*($_os_h{$key}||0)/$max_h)+1; } + if (($bredde_h==1) && $_os_h{$key}) { $bredde_h=2; } + print ""; + print ""; + print "\n"; + $count++; + } + } + } + # Write other records + print ""; + print ""; + print "\n"; + foreach my $key (@keylist) { + if ($keysinkeylist{$key}) { next; } + my $p=' '; + if ($Total) { $p=int($_os_h{$key}/$Total*1000)/10; $p="$p %"; } + print ""; + if ($key eq 'Unknown') { + print "\"\""; + } + else { + my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i; + my $libos=$OSHashLib{$keywithoutcumul}||$keywithoutcumul; + my $nameicon=$keywithoutcumul; $nameicon =~ s/[^\w]//g; + print "\"\""; + } + my $bredde_h=0; + if ($max_h > 0) { $bredde_h=int($BarWidth*($_os_h{$key}||0)/$max_h)+1; } + if (($bredde_h==1) && $_os_h{$key}) { $bredde_h=2; } + print ""; + print ""; + print "\n"; + } + &tab_end; + &html_end; + } if ($HTMLOutput{'browserdetail'}) { # Show browsers versions - print "$Center 
"; + print "$Center 
"; my $title="$Message[21]"; &tab_head("$title",19); print ""; @@ -7006,7 +7090,7 @@ if (scalar keys %HTMLOutput) { my $p=' '; if ($Total) { $p=int($totalfamily_h{$family}/$Total*1000)/10; $p="$p %"; } print ""; - print ""; + print ""; print "\n"; foreach my $key (reverse sort keys %_browser_h) { if ($key =~ /^$family(.*)/i) { @@ -8199,30 +8283,37 @@ if (scalar keys %HTMLOutput) { if ($ShowOSStats) { if ($Debug) { debug("ShowOSStats",2); } print "$Center 
\n"; - my $Totalh=0; foreach my $key (keys %_os_h) { $Totalh+=$_os_h{$key}; } - my $title="$Message[59]   -   $Message[0]"; + my $Totalh=0; my %new_os_h=(); + OSLOOP: foreach my $key (keys %_os_h) { + $Totalh+=$_os_h{$key}; + foreach my $family (@OSFamily) { if ($key =~ /^$family/i) { $new_os_h{"${family}cumul"}+=$_os_h{$key}; next OSLOOP; } } + $new_os_h{$key}+=$_os_h{$key}; + } + my $title="$Message[59]   -   $Message[58]   -   $Message[0]"; &tab_head("$title",19); - print "\n"; + print "\n"; my $count=0; - &BuildKeyList($MaxRowsInHTMLOutput,1,\%_os_h,\%_os_h); + &BuildKeyList($MaxRowsInHTMLOutput,1,\%new_os_h,\%new_os_h); foreach my $key (@keylist) { my $p=' '; - if ($Totalh) { $p=int($_os_h{$key}/$Totalh*1000)/10; $p="$p %"; } + if ($Totalh) { $p=int($new_os_h{$key}/$Totalh*1000)/10; $p="$p %"; } if ($key eq 'Unknown') { - print "\"\""; - print "\n"; - } + print "\"\"\n"; + } else { - my $newos=$OSHashLib{$key}||$key; - my $nameicon=lc($key); $nameicon =~ s/[^\w]+//g; - print "\"\""; - print "\n"; + my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i; + my $libos=$OSHashLib{$keywithoutcumul}||$keywithoutcumul; + my $nameicon=$keywithoutcumul; $nameicon =~ s/[^\w]//g; + # TODO Use OSFamilyLib + if ($libos eq 'win') { $libos="Windows"; } + if ($libos eq 'mac') { $libos="Macintosh"; } + print "\"\"\n"; } $count++; } &tab_end; } - + # BY BROWSER #---------------------------- if ($ShowBrowsersStats) { @@ -8236,7 +8327,7 @@ if (scalar keys %HTMLOutput) { } my $title="$Message[21]   -   $Message[58]   -   $Message[0]"; &tab_head("$title",19); - print "\n"; + print "\n"; my $count=0; &BuildKeyList($MaxRowsInHTMLOutput,1,\%new_browser_h,\%new_browser_h); foreach my $key (@keylist) { @@ -8249,7 +8340,7 @@ if (scalar keys %HTMLOutput) { my $keywithoutcumul=$key; $keywithoutcumul =~ s/cumul$//i; my $libbrowser=$BrowsersHashIDLib{$keywithoutcumul}||$keywithoutcumul; my $nameicon=$BrowsersHashIcon{$keywithoutcumul}||"notavailable"; - # TODO Use BrowsrsFamily + # TODO Use BrowsersFamilyLib if ($libbrowser eq 'netscape') { $libbrowser="Netscape"; } if ($libbrowser eq 'msie') { $libbrowser="MS Internet Explorer"; } print "\"\"\n"; @@ -8265,7 +8356,7 @@ if (scalar keys %HTMLOutput) { if ($Debug) { debug("ShowScreenSizeStats",2); } print "$Center 
\n"; my $Totalh=0; foreach my $key (keys %_screensize_h) { $Totalh+=$_screensize_h{$key}; } - my $title="$Message[135]"; + my $title="$Message[135] ($Message[77] $MaxNbOf{'ScreenSizesShown'})"; &tab_head("$title",0); print "\n"; my $total_h=0;
$Message[93]:
"); } if ($ShowMonthDayStats) { print ($frame?"
":""); print "$Message[5]/$Message[4]"; print ($frame?"
  \"...\" ":""); print "$Message[130]\n"; print ($frame?"
  \"...\" ":""); print "$Message[130]\n"; print ($frame?"
":""); print "$Message[91]"; print ($frame?"
":""); print "$Message[20]"; print ($frame?"
":""); print "$Message[73]"; print ($frame?"
":""); print "$Message[59]"; print ($frame?"
  \"...\" ":""); print "$Message[0]\n"; print ($frame?"
  \"...\" ":""); print "$Message[58]\n"; print ($frame?"
  \"...\" ":""); print "$Message[0]\n"; print ($frame?"
":""); print "$Message[21]"; print ($frame?"
  \"...\" ":""); print "$Message[58]\n"; print ($frame?"
  \"...\" ":""); print "$Message[0]\n"; print ($frame?"
  \"...\" ":""); print "$Message[0]\n"; print ($frame?"
":""); print "$Message[135]"; print ($frame?"
$Message[58]$Message[57]$Message[15] 
".uc($family)."".int($totalfamily_h{$family})."$p 
$OSHashLib{$key}$_os_h{$key}$p"; + # alt and title are not provided to reduce page size + if ($ShowOSStats) { print "
"; } + print "
".uc($Message[2])."   
$Message[0]$libos$_os_h{$key}$p"; + # alt and title are not provided to reduce page size + if ($ShowOSStats) { print "
"; } + print "
$Message[58]
".uc($family)." ".($totalfamily_h{$family}?$totalfamily_h{$family}:' ')."$p  ".int($totalfamily_h{$family})."$p 
OS$Message[57]$Message[15]
 $Message[59]$Message[57]$Message[15]
$Message[0]$_os_h{$key}$p
$Message[0]$_os_h{$key}$p
$newos$_os_h{$key}$p
$libos$new_os_h{$key}$p
$Message[21]$Message[111]$Message[57]$Message[15]
 $Message[21]$Message[111]$Message[57]$Message[15]
$libbrowser".($BrowsersHereAreGrabbers{$key}?"$Message[112]":"$Message[113]")."$new_browser_h{$key}$p
$Message[135]$Message[15]