https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115071
Revision: 115071
Author: a_engels
Date: 2012-04-27 19:49:51 +0000 (Fri, 27 Apr 2012)
Log Message:
-----------
various fixes
Modified Paths:
--------------
trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm
trunk/wikistats/squids/SquidCountArchiveReadInput.pm
trunk/wikistats/squids/SquidCountArchiveWriteOutput.pm
trunk/wikistats/squids/SquidReportArchive.pl
Modified: trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm
===================================================================
--- trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm 2012-04-27
01:24:20 UTC (rev 115070)
+++ trunk/wikistats/squids/SquidCountArchiveProcessLogRecord.pm 2012-04-27
19:49:51 UTC (rev 115071)
@@ -506,7 +506,12 @@
# WIKIPEDIA MOBILE
elsif ($agent2 =~ /(Wiktionary|Wikipedia)Mobile(\/| )\d+/io)
- { ($version = $agent2) =~ s/^.*((Wiktionary|Wikipedia)Mobile(\/|
)(\d|\.)+).*$/Android: $1 (WMF)/o ; }
+ {
+ if ($agent2 =~ /Android/io)
+ { ($version = $agent2) =~ s/^.*((Wiktionary|Wikipedia)Mobile(\/|
)(\d|\.)+).*$/Android: $1 (WMF)/o ; }
+ else
+ { ($version = $agent2) =~ s/^.*((Wiktionary|Wikipedia)Mobile(\/|
)(\d|\.)+).*$/iOS: $1 (WMF)/o ; }
+ }
# ANDROID
elsif ($agent2 =~ /Android\/\d+/io)
@@ -702,7 +707,12 @@
elsif ($agent eq "-")
{ $browsertype = '-' ; }
elsif ($agent2 =~ /(Wikipedia|Wiktionary)Mobile/io)
- { $browsertype = 'A' ; }
+ {
+ if ($agent2 =~ /Android/io)
+ { $browsertype = 'A' ; }
+ else
+ { $browsertype = 'I' ; }
+ }
elsif ($agent2 =~ /Dalvik/io)
{ $browsertype = 'a' ; }
elsif ($agent2 =~ /^iOS: /io)
Modified: trunk/wikistats/squids/SquidCountArchiveReadInput.pm
===================================================================
--- trunk/wikistats/squids/SquidCountArchiveReadInput.pm 2012-04-27
01:24:20 UTC (rev 115070)
+++ trunk/wikistats/squids/SquidCountArchiveReadInput.pm 2012-04-27
19:49:51 UTC (rev 115071)
@@ -47,7 +47,7 @@
($sec,$min,$hour,$day,$month,$year) = localtime ($time_start -
$days_ago_inspect * 24 * 3600) ;
$date_archived = sprintf ("%4d%02d%02d", $year+1900, $month+1, $day) ;
- print "\n- Inspect file saved $days_ago_inspect days ago:
$logname-$date_archived.gz\n" ;
+ print "\n- Inspect file saved $days_ago_inspect days ago:
$cfg_logname-$date_archived.gz\n" ;
my $file = "$dir_in/$cfg_logname-$date_archived.gz" ;
Modified: trunk/wikistats/squids/SquidCountArchiveWriteOutput.pm
===================================================================
--- trunk/wikistats/squids/SquidCountArchiveWriteOutput.pm 2012-04-27
01:24:20 UTC (rev 115070)
+++ trunk/wikistats/squids/SquidCountArchiveWriteOutput.pm 2012-04-27
19:49:51 UTC (rev 115071)
@@ -745,8 +745,8 @@
print CSV_AGENTS "$key,$count\n" ;
}
- print CSV_COUNTRIES_INFO "# pos 1: M = mobile/non-mobile status, O = opsys,
B = browser/client" ;
- print CSV_COUNTRIES_INFO ":type,country,value,count" ;
+ print CSV_COUNTRIES_INFO "# pos 1: M = mobile/non-mobile status, O = opsys,
B = browser/client\n" ;
+ print CSV_COUNTRIES_INFO ":type,country,value,count\n" ;
foreach $key (sort keys %country_info)
{
Modified: trunk/wikistats/squids/SquidReportArchive.pl
===================================================================
--- trunk/wikistats/squids/SquidReportArchive.pl 2012-04-27 01:24:20 UTC
(rev 115070)
+++ trunk/wikistats/squids/SquidReportArchive.pl 2012-04-27 19:49:51 UTC
(rev 115071)
@@ -4923,6 +4923,7 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other') ;
next if ($counter >= 50 or $country eq '--') ;
$countryname = $country_codes {$country} ;
if (not $countryname)
@@ -4937,6 +4938,7 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other') ;
if ($counter >= 50 or $country eq '--')
{
$countrytotal { 'other' } += $countrytotal { $country } ;
@@ -4969,6 +4971,7 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ( $country eq 'other' ) ;
if ( $counter >= 50 or $country eq '--')
{
$countryos { 'other', $os } += $countryos {$country, $os} ;
@@ -4984,13 +4987,16 @@
$showperc = &ShowPerc (100 * $countryos { $country, $os } / $countrytotal
{ $country } ) ;
$html .= "<td class=rt>$showvalue</td><td class=rt>$showperc</td></tr>" ;
}
+ $os = 'other' ;
$otheros = 0 ;
$counter = 0 ;
+ $html .= "<tr><td class=rt>Other OS</td>" ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ( $country eq 'other') ;
if ( $counter >= 50 or $country eq '--')
{
- $otheros += $countryos { $country, $os } ;
+ $countryos { 'other', $os } += $countryos { $country, $os } ;
next ;
}
$showvalue = &ShowCount ($countryos { $country, $os } * $multiplier ) ;
@@ -5011,10 +5017,11 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other') ;
next if ($counter >= 50 or $country eq '--') ;
$countryname = $country_codes {$country} ;
if (not $countryname)
- { $countryname = $country }
+ { $countryname = $country ; }
$html .= "<th class=c colspan='2'>$countryname</th>" ;
$counter += 1 ;
}
@@ -5024,8 +5031,10 @@
$html .= "<tr><td class=lt>Total requests</td><td
class=rt>$showvalue</td><td class=rt>$showperc</td>" ;
$othertotal = 0 ;
$counter = 0 ;
+ $countrytotal { 'other' } = 0;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ( $country eq 'other') ;
if ($counter >= 50 or $country eq '--')
{
$countrytotal { 'other' } += $countrytotal { $country } ;
@@ -5044,6 +5053,7 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other') ;
if ($counter >= 50 or $country eq '--')
{
$countrymobile { 'other' } += $countrymobile { $country } ;
@@ -5075,6 +5085,7 @@
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other' ) ;
if ( $counter >= 50 or $country eq '--')
{
$countrybrowser { 'other', $browser } += $countrybrowser { $country,
$browser } ;
@@ -5086,17 +5097,18 @@
$counter += 1 ;
}
$country = 'other' ;
- $showvalue = &ShowCount ($countrybrowser { $country, $browser } *
$multiplier ) ;
- $showperc = &ShowPerc (100 * $countrybrowser { $country, $browser } /
$countrytotal { $country } ) ;
+ $showvalue = &ShowCount ($allcountrybrowser { $browser } * $multiplier ) ;
+ $showperc = &ShowPerc (100 * $allcountrybrowser { $browser } /
$countrytotal { $country } ) ;
$html .= "<td class=rt>$showvalue</td><td class=rt>$showperc</td></tr>" ;
}
$browser = 'other' ;
- $showvalue = &ShowCount ($countrybrowser {$browser} * $multiplier) ;
- $showperc = &ShowPerc (100 * $countrybrowser {$browser} / $allcountrytotal) ;
+ $showvalue = &ShowCount ($allcountrybrowser {$browser} * $multiplier) ;
+ $showperc = &ShowPerc (100 * $allcountrybrowser {$browser} /
$allcountrytotal) ;
$html .= "<tr><td class=lt>$browser</td><td class=rt>$showvalue</td><td
class=rt>$showperc</td>" ;
$counter = 0 ;
foreach $country (keys_sorted_by_value_num_desc %countrytotal)
{
+ next if ($country eq 'other') ;
if ( $counter >= 50 or $country eq '--')
{
$countrybrowser { 'other', $browser } += $countrybrowser { $country,
$browser } ;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs