r114677 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114676‎ | r114677 | r114678 >
Date:00:12, 3 April 2012
Author:ezachte
Status:new
Tags:
Comment:
misc.
Modified paths:
  • /trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm (modified) (history)
  • /trunk/wikistats/squids/SquidReportArchive.pl (modified) (history)

Diff [purge]

Index: trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm
@@ -290,7 +290,7 @@
291291
292292 $os = ".." ;
293293
294 - if ($agent2 =~ /CFNetwork/io) { $os = "iOS/OS X" }
 294+ if ($agent2 =~ /CFNetwork/io) { $os = "iOS/OS X" }
295295 elsif ($agent2 =~ /BlackBerry/io) {($os = $agent2) =~ s/^.*?BlackBerry[^\/]*\/(\d+\.\d+).*$/BlackBerry\/$1/io ; } # BlackBerry/8320/4.2 -> BlackBerry/4.2
296296 elsif ($agent2 =~ /DoCoMo/io) { $os = "DoCoMo" ; }
297297 elsif ($agent2 =~ /iPad/io) { $version = "iPad" ; ($os = $agent2) =~ s/^.*?(iPad OS \d+\_\d+).*$/$1/io ; }
@@ -346,7 +346,7 @@
347347 if (($os eq '..') && ($mobile eq 'M' || $mobile eq 'W'))
348348 {
349349 $os = "Mobile other" ;
350 - $mobile_other {$agent2} += $count_event ;
 350+ $mobile_other {$agent2} += $count_event ;
351351 }
352352
353353 if ($version =~ /(?:iPod|iPhone)/io)
@@ -410,9 +410,9 @@
411411
412412 # iOS APPLICATIONS
413413 elsif ($agent2 =~ /CFNetwork/io)
414 - {
 414+ {
415415 $agent2 =~ s/^(.*) CFNetwork.*$/iOS: $1/io ;
416 - if ($agent2 =~ /Wikipedia Mobile\//io) { $agent2 =~ s/$/ (WMF)/io ; }
 416+ if ($agent2 =~ /Wikipedia Mobile\//io) { $agent2 =~ s/$/ (WMF)/io ; }
417417 $version = $agent2 ;
418418 }
419419
@@ -476,7 +476,7 @@
477477
478478 # CHROME MOBILE
479479 elsif ($agent2 =~ /CrMo\/\d+/io)
480 - { ($version = $agent2) =~ s/^.*?(CrMo\/\d+\.\d+).*$/$1/o ;
 480+ { ($version = $agent2) =~ s/^.*?(CrMo\/\d+\.\d+).*$/$1/o ;
481481 $version =~ s/CrMo/ChromeMobile/o ;
482482 }
483483
@@ -610,7 +610,8 @@
611611 $clients {"$mobile,$version,$mimecat"} += $count_event ; ;
612612
613613 $operating_systems =~ s/,/,/go ;
614 - $operating_systems {"$mobile,$os"} += $count_event ; ;
 614+ ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for SquidReportClients only
 615+ $operating_systems {"$mobile2,$os"} += $count_event ; ;
615616 }
616617
617618 if ($count_hits_per_ip_range)
@@ -669,7 +670,7 @@
670671 if ($url =~ /api\.php?.*action=/io)
671672 {
672673 $api = $parm ;
673 - $api =~ s/^.*action=([^\&]*)(\&.*)?$/$1/io ;
 674+ $api =~ s/^.*action=([^\&]*)(\&.*)?$/$1/io ;
674675 }
675676
676677 #create useragents
@@ -799,14 +800,16 @@
800801 if (! $test)
801802 {
802803 $time2 = substr ($time,0,19) ; # omit msec
803 - $line = "$time2,$client_ip,$domain,$ind_bot2,$mobile,$os,$version,$mimecat\n" ;
 804+ ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for SquidReportClients only
 805+ $line = "$time2,$client_ip,$domain,$ind_bot2,$mobile2,$os,$version,$mimecat\n" ;
804806 $gz_csv_views_viz->gzwrite($line) || die "Zlib error writing to $file_csv_views_viz: $gz_csv_views_viz->gzerror\n" ;
805807 }
806808 }
807809
808 - $records {"$mobile,$mimecat"} += $count_event ;
 810+ ($mobile2 = $mobile) =~ s/W/M/; # code 'W' was introduced for SquidReportClients only
 811+ $records {"$mobile2,$mimecat"} += $count_event ;
809812 $records {"*,$mimecat"} += $count_event ;
810 - $records {"$mobile,*"} += $count_event ;
 813+ $records {"$mobile2,*"} += $count_event ;
811814 $records {"*,*"} += $count_event ;
812815 }
813816
Index: trunk/wikistats/squids/SquidReportArchive.pl
@@ -1853,7 +1853,7 @@
18541854 { $site = 'W' ; }
18551855 else
18561856 { $site = 'X' ; }
1857 -
 1857+
18581858 $countua {$agent, '.', '.', '.'} += $count ;
18591859 $countua {$agent, '.', '.', $api} += $count ;
18601860 $countua {$agent, $site, $page, '.'} += $count ;
@@ -2916,7 +2916,7 @@
29172917 { $mimetype2 .= "<br><small>(img)</small> " ; }
29182918 if ($columns == 1)
29192919 { $mimetype2 = "<font color=#008000>$mimetype2</font>" ; }
2920 - if (($columns >= 2) && ($columns <= 4))
 2920+ elsif (($columns >= 2) && ($columns <= 4))
29212921 { $mimetype2 = "<font color=#900000>$mimetype2</font>" ; }
29222922 ($mime1,$mime2) = split ('\/', $mimetype2, 2) ;
29232923 $header2 .= "<th class=c>$mime1<br>$mime2</th>\n" ;
@@ -3014,7 +3014,7 @@
30153015 $count = &FormatCount ($counts_pm {"$project,$mimetype"}) ;
30163016 if ($columns == 1)
30173017 { $html .= &ShowCountTd ($count,"#008000") ; }
3018 - if (($columns >= 2) && ($columns <= 4))
 3018+ elsif (($columns >= 2) && ($columns <= 4))
30193019 { $html .= &ShowCountTd ($count,"#900000") ; }
30203020 else
30213021 { $html .= &ShowCountTd ($count) . "\n" ; }
@@ -4461,7 +4461,7 @@
44624462
44634463 my $total_count = $countua {'T', '.', '.', '.'} ;
44644464 my $total_html = $countua {'T', '.', 'page', '.'} ;
4465 - my $api_multiplier = $countua {'S', '.', 'page', '.'} / $countua {'S', '.', '.', 'opensearch' } ;
 4465+ my $api_multiplier = $countua {'S', '.', 'page', '.'} / $countua {'S', '.', '.', 'opensearch' } ;
44664466
44674467 $mobile_browsers_all = &ShowCount ($countua {'M', '.', '.', '.'}, $marker_color) ;
44684468 $mobile_browsers_all_mobile = &ShowCount ($countua {'M', 'M', '.', '.'}) ;
@@ -6202,7 +6202,7 @@
62036203 {
62046204 my ($num,$color) = @_ ;
62056205
6206 - return ("<td class=r>" . &ShowCount ($num) . "</td>") ;
 6206+ return ("<td class=r>" . &ShowCount ($num,$color) . "</td>") ;
62076207 }
62086208
62096209 sub ShowCountTh