https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114677

Revision: 114677
Author:   ezachte
Date:     2012-04-03 00:12:40 +0000 (Tue, 03 Apr 2012)
Log Message:
-----------
misc.

Modified Paths:
--------------
    trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm
    trunk/wikistats/squids/SquidReportArchive.pl

Modified: trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm
===================================================================
--- trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm 2012-04-02 
23:50:49 UTC (rev 114676)
+++ trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm 2012-04-03 
00:12:40 UTC (rev 114677)
@@ -290,7 +290,7 @@
 
   $os = ".." ;
 
-  if ($agent2 =~ /CFNetwork/io)         { $os = "iOS/OS X" } 
+  if ($agent2 =~ /CFNetwork/io)         { $os = "iOS/OS X" }
   elsif ($agent2 =~ /BlackBerry/io)     {($os = $agent2) =~ 
s/^.*?BlackBerry[^\/]*\/(\d+\.\d+).*$/BlackBerry\/$1/io ; } # 
BlackBerry/8320/4.2 -> BlackBerry/4.2
   elsif ($agent2 =~ /DoCoMo/io)         { $os = "DoCoMo" ; }
   elsif ($agent2 =~ /iPad/io)           { $version = "iPad" ;   ($os = 
$agent2) =~ s/^.*?(iPad OS \d+\_\d+).*$/$1/io ; }
@@ -346,7 +346,7 @@
   if (($os eq '..') && ($mobile eq 'M' || $mobile eq 'W'))
   {
     $os = "Mobile other" ;
-    $mobile_other {$agent2} += $count_event ; 
+    $mobile_other {$agent2} += $count_event ;
   }
 
   if ($version =~ /(?:iPod|iPhone)/io)
@@ -410,9 +410,9 @@
 
   # iOS APPLICATIONS
   elsif ($agent2 =~ /CFNetwork/io)
-  { 
+  {
     $agent2 =~ s/^(.*) CFNetwork.*$/iOS: $1/io ;
-    if ($agent2 =~ /Wikipedia Mobile\//io) { $agent2 =~ s/$/ (WMF)/io ; } 
+    if ($agent2 =~ /Wikipedia Mobile\//io) { $agent2 =~ s/$/ (WMF)/io ; }
     $version = $agent2 ;
   }
 
@@ -476,7 +476,7 @@
 
   # CHROME MOBILE
   elsif ($agent2 =~ /CrMo\/\d+/io)
-  { ($version = $agent2) =~ s/^.*?(CrMo\/\d+\.\d+).*$/$1/o ; 
+  { ($version = $agent2) =~ s/^.*?(CrMo\/\d+\.\d+).*$/$1/o ;
     $version =~ s/CrMo/ChromeMobile/o ;
   }
 
@@ -610,7 +610,8 @@
     $clients {"$mobile,$version,$mimecat"} += $count_event ; ;
 
     $operating_systems =~ s/,/,/go ;
-    $operating_systems {"$mobile,$os"} += $count_event ; ;
+    ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for 
SquidReportClients only
+    $operating_systems {"$mobile2,$os"} += $count_event ; ;
   }
 
   if ($count_hits_per_ip_range)
@@ -669,7 +670,7 @@
   if ($url =~ /api\.php?.*action=/io)
   {
       $api = $parm ;
-      $api =~ s/^.*action=([^\&]*)(\&.*)?$/$1/io ; 
+      $api =~ s/^.*action=([^\&]*)(\&.*)?$/$1/io ;
   }
 
   #create useragents
@@ -799,14 +800,16 @@
     if (! $test)
     {
       $time2    = substr ($time,0,19) ; # omit msec
-      $line = 
"$time2,$client_ip,$domain,$ind_bot2,$mobile,$os,$version,$mimecat\n" ;
+      ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for 
SquidReportClients only
+      $line = 
"$time2,$client_ip,$domain,$ind_bot2,$mobile2,$os,$version,$mimecat\n" ;
       $gz_csv_views_viz->gzwrite($line) || die "Zlib error writing to 
$file_csv_views_viz: $gz_csv_views_viz->gzerror\n" ;
     }
   }
 
-  $records {"$mobile,$mimecat"} += $count_event ;
+  ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for 
SquidReportClients only
+  $records {"$mobile2,$mimecat"} += $count_event ;
   $records {"*,$mimecat"}       += $count_event ;
-  $records {"$mobile,*"}        += $count_event ;
+  $records {"$mobile2,*"}        += $count_event ;
   $records {"*,*"}              += $count_event ;
 }
 

Modified: trunk/wikistats/squids/SquidReportArchive.pl
===================================================================
--- trunk/wikistats/squids/SquidReportArchive.pl        2012-04-02 23:50:49 UTC 
(rev 114676)
+++ trunk/wikistats/squids/SquidReportArchive.pl        2012-04-03 00:12:40 UTC 
(rev 114677)
@@ -1853,7 +1853,7 @@
       { $site = 'W' ; }
     else
       { $site = 'X' ; }
-    
+
     $countua {$agent, '.', '.', '.'} += $count ;
     $countua {$agent, '.', '.', $api} += $count ;
     $countua {$agent, $site, $page, '.'} += $count ;
@@ -2916,7 +2916,7 @@
     { $mimetype2 .= "<br><small>(img)</small> " ; }
     if ($columns == 1)
     { $mimetype2 = "<font color=#008000>$mimetype2</font>" ; }
-    if (($columns >= 2) && ($columns <= 4))
+    elsif (($columns >= 2) && ($columns <= 4))
     { $mimetype2 = "<font color=#900000>$mimetype2</font>" ; }
     ($mime1,$mime2) = split ('\/', $mimetype2, 2) ;
     $header2 .= "<th class=c>$mime1<br>$mime2</th>\n" ;
@@ -3014,7 +3014,7 @@
       $count = &FormatCount ($counts_pm {"$project,$mimetype"}) ;
       if ($columns == 1)
       { $html .= &ShowCountTd ($count,"#008000") ; }
-      if (($columns >= 2) && ($columns <= 4))
+      elsif (($columns >= 2) && ($columns <= 4))
       { $html .= &ShowCountTd ($count,"#900000") ; }
       else
       { $html .= &ShowCountTd ($count) . "\n" ; }
@@ -4461,7 +4461,7 @@
 
   my $total_count                = $countua {'T', '.', '.', '.'} ;
   my $total_html                 = $countua {'T', '.', 'page', '.'} ;
-  my $api_multiplier             = $countua {'S', '.', 'page', '.'} / $countua 
{'S', '.', '.', 'opensearch' } ; 
+  my $api_multiplier             = $countua {'S', '.', 'page', '.'} / $countua 
{'S', '.', '.', 'opensearch' } ;
 
   $mobile_browsers_all           = &ShowCount ($countua {'M', '.', '.', '.'},  
$marker_color) ;
   $mobile_browsers_all_mobile    = &ShowCount ($countua {'M', 'M', '.', '.'}) ;
@@ -6202,7 +6202,7 @@
 {
   my ($num,$color) = @_ ;
 
-  return ("<td class=r>" . &ShowCount ($num) . "</td>") ;
+  return ("<td class=r>" . &ShowCount ($num,$color) . "</td>") ;
 }
 
 sub ShowCountTh


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to