r112306 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112305‎ | r112306 | r112307 >
Date:09:51, 24 February 2012
Author:ezachte
Status:deferred
Tags:
Comment:
many regexps for literals added / updated
Modified paths:
  • /trunk/wikistats/squids/SquidReportArchive.pl (modified) (history)

Diff [purge]

Index: trunk/wikistats/squids/SquidReportArchive.pl
@@ -9,9 +9,9 @@
1010
1111 # set defaults mainly for tests on local machine
1212 # default_argv "-m 2011-07 " ;
13 -# default_argv "-c -q 2010Q1" ;
 13+ default_argv "-c -q 2011Q4" ;
1414 # default_argv "-w" ; # refresh country info from Wikipedia (population etc)
15 - default_argv "-c" ;
 15+# default_argv "-c" ;
1616
1717 # to do: add text from http://wiki.squid-cache.org/SquidFaq/SquidLogs
1818 # ReportOrigin how to handle '!error <-> other
@@ -508,6 +508,8 @@
509509 "Absolute traffic counts for October 2011 are approximatly 7% too low.<br>" .
510510 "Data loss only occurred during peak hours. It therefore may have had somewhat different impact for traffic from different parts of the world.<br>" .
511511 "and may have also skewed relative figures like share of traffic per browser or operating system.</font><p>" ;
 512+ $header .= "<font color=#900000>From mid September till late November squid log records for mobile traffic were in invalid format.<br>" .
 513+ "Data could be repaired for logs from mid October onwards. Older logs were no longer available.<p>" ;
512514 $header .= "<font color=#900000>In a an unrelated server outage precisely half of traffic to WMF mobile sites was not counted from Oct 16 - Nov 29 (one of two load-balanced servers did not report traffic).<br>" .
513515 "WMF has since improved server monitoring, so that similar outages should be detected and fixed much faster from now on.</font><p>" ;
514516 }
@@ -1401,16 +1403,15 @@
14021404 chomp $line ;
14031405
14041406 $line =~ s/[\x00-\x1f]//g ;
1405 - $line =~ s/C..?te d'Ivoire/C&ocirc;te d'Ivoire/g ;
14061407
14071408 ($country,$link,$population,$connected,$icon) = split ',', $line ;
1408 - print "COUNTRY $country\nLINK $link\nPOPULATION $population\nCONNECTED $connected\n\n" ;
 1409+ # print "COUNTRY $country\nLINK $link\nPOPULATION $population\nCONNECTED $connected\n\n" ;
14091410 $country =~ s/&comma;/,/g ;
14101411
14111412 # use country names as given by MaxMind
14121413 $country =~ s/Brunei/Brunei Darussalam/ ;
1413 - $country =~ s/Congo, The Democratic Republic of the/Republic of the Congo/ ;
1414 - $country =~ s/Dem. Rep. of Congo/Congo - The Democratic Republic of the/ ;
 1414+ # $country =~ s/Congo, The Democratic Republic of the/Democratic Republic of the Congo/ ;
 1415+ # $country =~ s/Dem. Rep. of Congo/Democratic Republic of the Congo/ ;
14151416 $country =~ s/East timor/Timor-Leste/ ;
14161417 $country =~ s/Guyane/French Guiana/ ;
14171418 $country =~ s/Iran/Iran, Islamic Republic of/ ;
@@ -1418,17 +1419,20 @@
14191420 $country =~ s/Libya/Libyan Arab Jamahiriya/ ;
14201421 $country =~ s/Macau/Macao/ ;
14211422 $country =~ s/Moldova/Moldova, Republic of/ ;
1422 - $country =~ s/North Korea/Korea, Republic of/ ;
 1423+ # $country =~ s/North Korea/Korea, Republic of/ ;
14231424 $country =~ s/Palestine/Palestinian Territory/ ;
1424 - $country =~ s/Republic of the Congo/Congo/ ;
 1425+ # $country =~ s/Republic of the Congo/Congo/ ;
14251426 $country =~ s/Russia/Russian Federation/ ;
1426 - $country =~ s/North Korea/Korea, Democratic People's Republic of/ ;
1427 - $country =~ s/South Korea/Korea, Republic of/ ;
 1427+ # $country =~ s/North Korea/Korea, Democratic People's Republic of/ ;
 1428+ # $country =~ s/South Korea/Korea, Republic of/ ;
14281429 $country =~ s/Syria/Syrian Arab Republic/ ;
14291430 $country =~ s/Tanzania/Tanzania, United Republic of/ ;
14301431 $country =~ s/U.S. Virgin Islands/Virgin Islands, British/ ;
14311432 $country =~ s/Vatican City/Holy See (Vatican City State)/ ;
1432 - $country =~ s/^Korea$/South Korea/ ;
 1433+ # $country =~ s/^Korea$/South Korea/ ;
 1434+
 1435+ if ($connected eq 'connected')
 1436+ { &Log ("connected unknown: $country\n") ; }
14331437 $connected =~ s/connected/../g ;
14341438 $country_meta_info {$country} = "$link,$population,$connected,$icon" ;
14351439
@@ -4767,12 +4771,12 @@
47684772 # now use country names that are suitable for http://gunn.co.nz/map/
47694773 $country2 = $country ;
47704774 $country2 =~ s/Moldova, Republic of/Moldova/ ;
4771 - $country2 =~ s/Korea, Republic of/South Korea/ ;
4772 - $country2 =~ s/Korea, Democratic People's Republic of/North Korea/ ;
 4775+ # $country2 =~ s/Korea, Republic of/South Korea/ ;
 4776+ # $country2 =~ s/Korea, Democratic People's Republic of/North Korea/ ;
47734777 $country2 =~ s/Iran, Islamic Republic of/Iran/ ;
47744778 $country2 =~ s/UAE/United Arab Emirates/ ;
47754779 $country2 =~ s/Congo - The Democratic Republic of the/Democratic Republic of the Congo/ ;
4776 - $country2 =~ s/^Congo$/Republic of the Congo/ ;
 4780+ # $country2 =~ s/^Congo$/Republic of the Congo/ ;
47774781 $country2 =~ s/Syrian Arab Republic/Syria/ ;
47784782 $country2 =~ s/Tanzania, United Republic of/Tanzania/ ;
47794783 $country2 =~ s/Libyan Arab Jamahiriya/Libya/ ;
@@ -5091,7 +5095,7 @@
50925096 $country =~ s/Iran, Islamic Republic of/Iran/ ;
50935097 $country =~ s/UAE/United Arab Emirates/ ;
50945098 $country =~ s/Congo - The Democratic Republic of the/Democratic Republic of the Congo/ ;
5095 - $country =~ s/^Congo$/Republic of the Congo/ ;
 5099+ # $country =~ s/^Congo$/Republic of the Congo/ ;
50965100 $country =~ s/Syrian Arab Republic/Syria/ ;
50975101 $country =~ s/Tanzania, United Republic of/Tanzania/ ;
50985102 $country =~ s/Libyan Arab Jamahiriya/Libya/ ;
@@ -6173,7 +6177,21 @@
61746178 $link =~ s/,/&comma;/g ;
61756179 $icon =~ s/,/&comma;/g ;
61766180
6177 - print "country: $country\nlink: $link\npopulation: $population\nconnected: $connected\nicon: $icon\n\n" ;
 6181+ $country =~ s/Bosnia-Herzegovina/Bosnia and Herzegovina/ ;
 6182+ $country =~ s/C.*.+te d'Ivoire/Cote d'Ivoire/ ;
 6183+ $country =~ s/Macao/Macau/ ; # will be changed back later
 6184+ $country =~ s/Samoa/American Samoa/ ;
 6185+ $country =~ s/Timor Leste/Timor-Leste/ ;
 6186+ $country =~ s/UAE/United Arab Emirates/ ;
 6187+ $country =~ s/Korea, South/South Korea/ ;
 6188+ $country =~ s/Congo, Democratic Republic of/Democratic Republic of the Congo/ ;
 6189+ $country =~ s/Congo, Republic of/Republic of the Congo/ ;
 6190+ $country =~ s/Macedonia, Republic of/Republic of Macedonia/ ;
 6191+ $country =~ s/Gambia, The/Gambia/ ;
 6192+ $country =~ s/Bahamas, The/The Bahamas/ ;
 6193+ $country =~ s/,/&comma;/g ;
 6194+
 6195+ # print "country: $country\nlink: $link\npopulation: $population\nconnected: $connected\nicon: $icon\n\n" ;
61786196 $countries {$country} = "$country,$link,$population,connected,$icon\n" ;
61796197 }
61806198
@@ -6210,17 +6228,33 @@
62116229
62126230 $country =~ s/,/&comma;/g ;
62136231 $country =~ s/Bosnia-Herzegovina/Bosnia and Herzegovina/ ;
6214 - $country =~ s/Cote d'Ivoire/C&ocirc;te d'Ivoire/ ;
 6232+ $country =~ s/C.*.+te d'Ivoire/Cote d'Ivoire/ ;
62156233 $country =~ s/Macao/Macau/ ; # will be changed back later
62166234 $country =~ s/Samoa/American Samoa/ ;
62176235 $country =~ s/Timor Leste/Timor-Leste/ ;
62186236 $country =~ s/UAE/United Arab Emirates/ ;
 6237+ $country =~ s/Korea, South/South Korea/ ;
 6238+ $country =~ s/Congo, Democratic Republic of/Democratic Republic of the Congo/ ;
 6239+ $country =~ s/Congo, Republic of/Republic of the Congo/ ;
 6240+ $country =~ s/Macedonia, Republic of/Republic of Macedonia/ ;
 6241+ $country =~ s/Gambia, The/Gambia/ ;
 6242+ $country =~ s/Bahamas, The/The Bahamas/ ;
 6243+ $country =~ s/,/&comma;/g ;
62196244
62206245 print "country: $country\nconnected: $connected\n\n" ;
62216246 $countries {$country} =~ s/connected/$connected/ ;
62226247 }
62236248
6224 - print "Write $path_in/$file_csv_country_meta_info\n\n" ; # use $path_in, not $path_out so that next step picks up proper file
 6249+ &Log ("Metric 'connected' unknown for:\n\n") ;
 6250+ foreach $country (sort keys %countries)
 6251+ {
 6252+ $data = $countries {$country} ;
 6253+
 6254+ if ($data =~ /connected/)
 6255+ { &Log ("$country\n") ; }
 6256+ }
 6257+
 6258+ &Log ("Write $path_in/$file_csv_country_meta_info\n\n") ; # use $path_in, not $path_out so that next step picks up proper file
62256259 open COUNTRY_META_INFO, '>', "$path_in/$file_csv_country_meta_info" ;
62266260 foreach $country (sort keys %countries)
62276261 { print COUNTRY_META_INFO $countries {$country} ; }

Status & tagging log