r112305 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112304‎ | r112305 | r112306 >
Date:09:43, 24 February 2012
Author:ezachte
Status:deferred
Tags:
Comment:
many print statements -> &Log function, die -> abort
Modified paths:
  • /trunk/wikistats/squids/SquidReportArchive.pl (modified) (history)

Diff [purge]

Index: trunk/wikistats/squids/SquidReportArchive.pl
@@ -38,13 +38,13 @@
3939
4040 if (-d "/a/squid")
4141 {
42 - print "\n\nJob runs on server $hostname\n\n" ;
 42+ &Log ("\n\nJob runs on server $hostname\n\n") ;
4343 $path_in = "/a/ezachte" ;
4444 $path_out = "/a/ezachte" ;
4545 }
4646 elsif ($hostname eq 'bayes')
4747 {
48 - print "\n\nJob runs on server $hostname\n\n" ;
 48+ &Log ("\n\nJob runs on server $hostname\n\n") ;
4949 $path_in = "/home/ezachte/wikistats/animation" ;
5050 $path_out = "/home/ezachte/wikistats/animation" ;
5151 }
@@ -55,8 +55,8 @@
5656 $path_out = "/srv/erik/" ;
5757 }
5858
59 - print "Path in = $path_in\n" ;
60 - print "Path out = $path_out\n" ;
 59+ &Log ("Path in = $path_in\n") ;
 60+ &Log ("Path out = $path_out\n") ;
6161
6262 $file_csv_country_meta_info = "SquidReportCountryMetaInfo.csv" ;
6363
@@ -64,7 +64,7 @@
6565 # 'http://en.wikipedia.org/wiki/List_of_countries_by_population'
6666 # 'http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users'
6767 if (defined ($options {"w"}))
68 - { &ReadWikipedia ; print "Ready\n" ; exit ; }
 68+ { &ReadWikipedia ; &Log ("Ready\n") ; exit ; }
6969
7070 if (defined ($options {"c"}))
7171 { $reportcountries = $true ; }
@@ -75,7 +75,7 @@
7676 if ($quarter_only !~ /^2\d\d\dQ\d$/)
7777 { abort ("Specify run for one single quarter as -q yyyyQ[1-4], e.g. -q 2011Q3, not '$quarter_only'\n") ; }
7878 $quarter_only =~ s/^(\d\d\d\d)(Q\d)$/$1 $2/ ;
79 - print "QUARTER ONLY $quarter_only\n" ;
 79+ &Log ("QUARTER ONLY $quarter_only\n") ;
8080 }
8181
8282 # date range used to be read from csv file with ReadDate, now there are daily csv files
@@ -84,13 +84,13 @@
8585
8686 &InitProjectNames ;
8787
88 - $file_csv_country_codes = "CountryCodes.csv" ;
 88+ $file_csv_country_codes = "CountryCodes.csv" ;
8989
9090 &ReadInputCountriesNames ;
9191
9292 if ($reportcountries)
9393 {
94 - $project_mode = "wp" ;
 94+ $project_mode = "wp" ; # discard all log data from other projects than Wikipedia
9595
9696 &ReadInputCountriesMeta ;
9797
@@ -106,14 +106,14 @@
107107 $reportmonth = $options {"m"} ;
108108
109109 if (($reportmonth !~ /^\d\d\d\d-\d\d$/) && ($reportdaysback !~ /^-\d+$/))
110 - { print "Specify month as -m yyyy-mm or days back as -d -[days] (e.g. -d -1 for yesterday)" ; exit ; }
 110+ { &Log ("Specify month as -m yyyy-mm or days back as -d -[days] (e.g. -d -1 for yesterday)") ; exit ; }
111111
112112 if ($reportdaysback =~ /^-\d+$/)
113113 {
114114 ($sec,$min,$hour,$day,$month,$year) = localtime (time+$reportdaysback*86400) ;
115115 $reportmonth = sprintf ("%04d-%02d",$year+1900,$month+1) ;
116116 }
117 - print "Report month = $reportmonth\n" ;
 117+ &Log ("Report month = $reportmonth\n") ;
118118
119119 $threshold_mime = 0 ;
120120 $threshold_project = 10 ;
@@ -237,9 +237,9 @@
238238 {
239239 print "\nDays input = $days_input_found\n" ;
240240 $multiplier = 1 / $days_input_found ;
241 - print "\nMultiplier = " . sprintf ("%.4f", $multiplier) . "\n" ;
 241+ &Log ("\nMultiplier = " . sprintf ("%.4f", $multiplier) . "\n") ;
242242 }
243 - else { print "\nDays input = 0 (zero!)\n" ; }
 243+ else { &Log ("\nDays input = 0 (zero!)\n") ; }
244244
245245 &WriteCsvCountriesTimed ;
246246 &WriteCsvCountriesGoTo ;
@@ -313,12 +313,13 @@
314314 # &WriteCsvCountriesTargets ;
315315 close "FILE_LOG" ;
316316
317 - print "\nReady\n\n" ;
 317+ &Log ("\nReady\n\n") ;
318318 exit ;
319319
320320 sub ReportCountries
321321 {
322322 my $mode_report = shift ;
 323+ &Log ("\nReportCountries $mode_report\n\n") ;
323324
324325 if ($mode_report eq 'Views')
325326 {
@@ -398,6 +399,8 @@
399400
400401 sub ReadDate
401402 {
 403+ &Log ("ReadDate\n") ;
 404+
402405 open CSV_CRAWLERS, '<', "$path_process/$file_csv_crawlers" ;
403406 $line = <CSV_CRAWLERS> ;
404407 close CSV_CRAWLERS ;
@@ -425,12 +428,14 @@
426429
427430 $timespan = ($timetill - $timefrom) / 3600 ;
428431 $multiplier = (24 * 3600) / ($timetill - $timefrom) ;
429 - print "Multiplier = $multiplier\n" ;
 432+ &Log ("Multiplier = $multiplier\n") ;
430433 $header =~ s/DATE/Daily averages, based on sample period: $period (yyyy-mm-dd)/ ;
431434 }
432435
433436 sub SetPeriod
434437 {
 438+ &Log ("SetPeriod\n") ;
 439+
435440 $year_first = substr ($date_first,0,4) ;
436441 $month_first = substr ($date_first,5,2) ;
437442 $day_first = substr ($date_first,8,2) ;
@@ -447,11 +452,13 @@
448453
449454 $period = sprintf ("%d %s %d - %d %s %d", $day_first, month_english_short ($month_first-1), $year_first, $day_last, month_english_short ($month_last-1), $year_last) ;
450455 $header =~ s/DATE/Daily averages, based on sample period: $period/ ;
451 - print "Sample period: $period => for daily averages multiplier = " . sprintf ("%.2f",$multiplier) . "\n" ;
 456+ &Log ("Sample period: $period => for daily averages multiplier = " . sprintf ("%.2f",$multiplier) . "\n") ;
452457 }
453458
454459 sub PrepHtml
455460 {
 461+ &Log ("\nPrepHtml\n\n") ;
 462+
456463 $language = "en" ;
457464 $header = "<!DOCTYPE FILE_HTML PUBLIC '-//W3C//DTD FILE_HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>\n" .
458465 "<html lang='en'>\n" .
@@ -547,6 +554,8 @@
548555
549556 sub ReadCountryCodes
550557 {
 558+ &Log ("ReadCountryCodes\n") ;
 559+
551560 open CODES, '<', "$path_in/$file_csv_country_codes" ;
552561 while ($line = <CODES>)
553562 {
@@ -563,6 +572,8 @@
564573
565574 sub ReadInputClients
566575 {
 576+ &Log ("ReadInputClients\n") ;
 577+
567578 my $file_csv = "$path_process/$file_csv_clients" ;
568579 if (! -e $file_csv)
569580 { abort ("Function ReadInputClients: file $file_csv not found!!!") ; }
@@ -678,6 +689,8 @@
679690
680691 sub ReadInputCrawlers
681692 {
 693+ &Log ("ReadInputCrawlers\n") ;
 694+
682695 my $file_csv = "$path_process/$file_csv_crawlers" ;
683696 if (! -e $file_csv)
684697 { abort ("Function ReadInputCrawlers: file $file_csv not found!!!\n") ; }
@@ -733,6 +746,8 @@
734747
735748 sub ReadInputMethods
736749 {
 750+ &Log ("ReadInputMethods\n") ;
 751+
737752 my $file_csv = "$path_process/$file_csv_methods" ;
738753 if (! -e $file_csv)
739754 { abort ("Function ReadInputMethods: file $file_csv not found!!!") ; }
@@ -751,6 +766,8 @@
752767
753768 sub ReadInputMimeTypes
754769 {
 770+ &Log ("ReadInputMimeTypes\n") ;
 771+
755772 my $file_csv = "$path_process/$file_csv_requests" ;
756773 if (! -e $file_csv)
757774 { abort ("Function ReadInputMimeTypes: file $file_csv not found!!!") ; }
@@ -838,6 +855,8 @@
839856
840857 sub ReadInputOpSys
841858 {
 859+ &Log ("ReadInputOpSys\n") ;
 860+
842861 my $file_csv = "$path_process/$file_csv_opsys" ;
843862 if (! -e $file_csv)
844863 { abort ("Function ReadInputOpSys: file $file_csv not found!!!") ; }
@@ -898,6 +917,8 @@
899918
900919 sub ReadInputOrigins
901920 {
 921+ &Log ("ReadInputOrigins\n") ;
 922+
902923 my $file_csv = "$path_process/$file_csv_origins" ;
903924 if (! -e $file_csv)
904925 { abort ("Function ReadInputOrigins: file $file_csv not found!!!") ; }
@@ -981,6 +1002,8 @@
9821003
9831004 sub ReadInputScripts
9841005 {
 1006+ &Log ("ReadInputScripts\n") ;
 1007+
9851008 my $file_csv = "$path_process/$file_csv_scripts" ;
9861009 if (! -e $file_csv)
9871010 { abort ("Function ReadInputScripts: file $file_csv not found!!!") ; }
@@ -1081,6 +1104,8 @@
10821105
10831106 sub ReadInputGoogle
10841107 {
 1108+ &Log ("ReadInputGoogle\n") ;
 1109+
10851110 my $file_csv = "$path_process/$file_csv_google" ;
10861111 if (! -e $file_csv)
10871112 { abort ("Function ReadInputGoogle: file $file_csv not found!!!") ; }
@@ -1138,6 +1163,8 @@
11391164
11401165 sub ReadInputSkins
11411166 {
 1167+ &Log ("ReadInputSkins\n") ;
 1168+
11421169 my $file_csv = "$path_process/$file_csv_skins" ;
11431170 if (! -e $file_csv)
11441171 { abort ("Function ReadInputSkins: file $file_csv not found!!!") ; }
@@ -1159,6 +1186,8 @@
11601187
11611188 sub ReadInputIndexPhp
11621189 {
 1190+ &Log ("ReadInputIndexPhp\n") ;
 1191+
11631192 my $file_csv = "$path_process/$file_csv_indexphp" ;
11641193 if (! -e $file_csv)
11651194 { abort ("Function ReadInputIndexPhp: file $file_csv not found!!!") ; }
@@ -1285,6 +1314,8 @@
12861315
12871316 sub ReadInputCountriesTimed
12881317 {
 1318+ &Log ("ReadInputCountriesTimed\n") ;
 1319+
12891320 my $file_csv = "$path_process/public/$file_csv_countries_timed" ;
12901321 if (! -e $file_csv)
12911322 { abort ("Function ReadInputSkins: file $file_csv not found!!! ") ; }
@@ -1315,6 +1346,8 @@
13161347
13171348 sub ReadInputCountriesNames
13181349 {
 1350+ &Log ("ReadInputCountriesNames\n") ;
 1351+
13191352 $path_csv_country_codes = "$path_in/$file_csv_country_codes" ;
13201353 if (! -e $path_csv_country_codes) { abort ("Input file $path_csv_country_codes not found!") ; }
13211354
@@ -1356,9 +1389,11 @@
13571390
13581391 sub ReadInputCountriesMeta
13591392 {
 1393+ &Log ("ReadInputCountriesMeta\n") ;
 1394+
13601395 # http://en.wikipedia.org/wiki/List_of_countries_by_population
13611396 # http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users
1362 - print "Read $path_in/$file_csv_country_meta_info\n" ;
 1397+ &Log ("Read $path_in/$file_csv_country_meta_info\n") ;
13631398 open COUNTRY_META_INFO, '<', "$path_in/$file_csv_country_meta_info" ;
13641399 binmode COUNTRY_META_INFO ;
13651400 while ($line = <COUNTRY_META_INFO>)
@@ -1405,6 +1440,8 @@
14061441
14071442 sub CollectRegionCounts
14081443 {
 1444+ &Log ("CollectRegionCounts\n") ;
 1445+
14091446 my ($country_code, $region_code, $north_south_code, $country_name) ;
14101447
14111448 foreach $country_code (keys %country_names)
@@ -1437,6 +1474,8 @@
14381475
14391476 sub ReadInputCountriesMonthly
14401477 {
 1478+ &Log ("ReadInputCountriesMonthly\n") ;
 1479+
14411480 my $project_mode = shift ;
14421481
14431482 undef %yyyymm_ ;
@@ -1474,7 +1513,7 @@
14751514 $report_year += 1900 ;
14761515 $report_month ++ ;
14771516
1478 - print "Process project $project_mode\n\n" ;
 1517+ &Log ("Only process data for project $project_mode (wp=Wikipedia, etc)\n") ;
14791518
14801519 open CSV_SQUID_COUNTS_MONTHLY, '<', $path_csv_squid_counts_monthly ;
14811520 while ($line = <CSV_SQUID_COUNTS_MONTHLY>)
@@ -1547,19 +1586,20 @@
15481587 $requests_recently_per_language {$language} += $count ;
15491588 }
15501589 }
 1590+ &Log ("$lines lines read from $path_csv_squid_counts_monthly\n") ;
15511591
1552 - print "\n" ;
15531592 @quarters = keys_sorted_alpha_desc %quarters ;
15541593 foreach $quarter (@quarters)
15551594 {
1556 - print "Quarter $quarter: requests: " . (0+$requests_per_quarter {$quarter}) . "\n" ;
 1595+ &Log ("Quarter $quarter: requests: " . (0+$requests_per_quarter {$quarter}) . "\n") ;
 1596+
15571597 if ($requests_per_quarter {$quarter} == 0)
15581598 { abort ("No known requests found for quarter $quarter") ; }
15591599 }
1560 - print "\n" ;
 1600+ &Log ("\n") ;
15611601
15621602 $months_recently = keys %months_recently ;
1563 - if ($months_recently == 0) { die "\$months_recently == 0\n" ; }
 1603+ if ($months_recently == 0) { abort ("\$months_recently == 0\n") ; }
15641604
15651605 $requests_recently_start = substr ($requests_recently_start,0,4) . '/' . substr ($requests_recently_start,5,2);
15661606 $requests_recently_stop = substr ($requests_recently_stop ,0,4) . '/' . substr ($requests_recently_stop ,5,2) ;
@@ -1591,6 +1631,8 @@
15921632
15931633 sub ReadInputCountriesDaily
15941634 {
 1635+ &Log ("ReadInputCountriesDaily\n") ;
 1636+
15951637 # http://en.wikipedia.org/wiki/List_of_countries_by_population
15961638 # http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users
15971639
@@ -1617,7 +1659,7 @@
16181660 $report_year += 1900 ;
16191661 $report_month ++ ;
16201662
1621 - print "Process project $project_mode\n\n" ;
 1663+ &Log ("Process project $project_mode\n\n") ;
16221664
16231665 $yyyymmdd_prev = "" ;
16241666 open CSV_SQUID_COUNTS_DAILY, '<', $path_csv_squid_counts_daily ;
@@ -1626,7 +1668,7 @@
16271669 chomp $line ;
16281670 ($yyyymmdd,$project,$language,$code,$bot,$count) = split (',', $line) ;
16291671
1630 - die "\$yyyymmdd $yyyymmdd lt \$yyyymmdd_prev $yyyymmdd_prev" if $yyyymmdd lt $yyyymmdd_prev ;
 1672+ abort ("\$yyyymmdd $yyyymmdd lt \$yyyymmdd_prev $yyyymmdd_prev") if $yyyymmdd lt $yyyymmdd_prev ;
16311673 $yyyymmdd_prev = $yyyymmdd ;
16321674
16331675 ($code,$language) = &NormalizeSquidInput ($code,$language) ;
@@ -1715,13 +1757,15 @@
17161758 print TRACE sort @trace ;
17171759 close TRACE ;
17181760
1719 - # die "\$connected_us == 0" if $connected_us == 0 ;
 1761+ # abort ("\$connected_us == 0") if $connected_us == 0 ;
17201762 if ($connected_us > 0)
17211763 { $max_requests_per_connected_us_week = sprintf ("%.1f", (($max_requests_per_week_us * 1000) / $connected_us)) ; }
17221764 }
17231765
17241766 sub NormalizeSquidInput
17251767 {
 1768+# &Log ("NormalizeSquidInput\n") ;
 1769+
17261770 my ($code,$language) = @_ ;
17271771
17281772 if ($language eq "jp") { $language = "ja" ; }
@@ -1742,6 +1786,8 @@
17431787
17441788 sub DiscardSquidInput
17451789 {
 1790+# &Log ("DiscardSquidInput\n") ;
 1791+
17461792 ($bot,$project,$project_mode,$code,$language) = @_ ;
17471793 if ($bot ne "U" or # user
17481794 $project ne $project_mode or # eg 'wp'
@@ -1775,6 +1821,8 @@
17761822
17771823 sub ReadInputBrowserLanguages
17781824 {
 1825+ &Log ("ReadInputBrowserLanguages\n") ;
 1826+
17791827 my $file_csv = "$path_process/$file_csv_browser_languages" ;
17801828 if (! -e $file_csv)
17811829 { abort ("Function ReadInputBrowserLanguages: file $file_csv not found!!! ") ; }
@@ -1794,6 +1842,8 @@
17951843
17961844 sub CalcPercentages
17971845 {
 1846+ &Log ("CalcPercentages\n") ;
 1847+
17981848 my $total_opsys = $total_opsys_mobile + $total_opsys_non_mobile ;
17991849 my $total_opsys_html_only = $total_opsys_mobile_html_only + $total_opsys_non_mobile_html_only ;
18001850 foreach $key (keys %opsys)
@@ -1835,7 +1885,8 @@
18361886
18371887 sub NormalizeCounts
18381888 {
1839 -# ReadInputClients
 1889+ &Log ("NormalizeCounts\n") ;
 1890+
18401891 foreach $key (keys %engines)
18411892 { $engines {$key} = &Normalize ($engines {$key}) ; }
18421893
@@ -1982,6 +2033,8 @@
19832034
19842035 sub SortCounts
19852036 {
 2037+ &Log ("SortCounts\n") ;
 2038+
19862039 # ReadInputClients
19872040 # @engines_sorted_count = keys_sorted_by_value_num_desc %engines ;
19882041 @engines_sorted_alpha = keys_sorted_alpha_asc %engines ;
@@ -2045,7 +2098,8 @@
20462099
20472100 sub WriteReportClients
20482101 {
2049 - print "\nWriteReportClients -> $path_reports/$file_html_clients\n\n" ;
 2102+ &Log ("WriteReportClients -> $path_reports/$file_html_clients\n") ;
 2103+
20502104 open FILE_HTML_CLIENTS, '>', "$path_reports/$file_html_clients" ;
20512105
20522106 $html = $header ;
@@ -2514,6 +2568,8 @@
25152569
25162570 sub WriteReportCrawlers
25172571 {
 2572+ &Log ("WriteReportCrawlers\n") ;
 2573+
25182574 open FILE_HTML_CRAWLERS, '>', "$path_reports/$file_html_crawlers" ;
25192575
25202576 $html = $header ;
@@ -2688,6 +2744,8 @@
26892745
26902746 sub WriteReportMethods
26912747 {
 2748+ &Log ("WriteReportMethods\n") ;
 2749+
26922750 open FILE_HTML_METHODS, '>', "$path_reports/$file_html_methods" ;
26932751
26942752 $html = $header ;
@@ -2768,6 +2826,8 @@
27692827
27702828 sub WriteReportMimeTypes
27712829 {
 2830+ &Log ("WriteReportMimeTypes\n") ;
 2831+
27722832 open FILE_HTML_REQUESTS, '>', "$path_reports/$file_html_requests" ;
27732833
27742834 $html = $header ;
@@ -2938,6 +2998,8 @@
29392999
29403000 sub WriteReportOpSys
29413001 {
 3002+ &Log ("WriteReportOpSys\n") ;
 3003+
29423004 open FILE_HTML_OPSYS, '>', "$path_reports/$file_html_opsys" ;
29433005
29443006 $html = $header ;
@@ -3153,6 +3215,8 @@
31543216 # http://en.wikipedia.org/wiki/Domain_name
31553217 sub WriteReportOrigins
31563218 {
 3219+ &Log ("WriteReportOrigins\n") ;
 3220+
31573221 open FILE_HTML_ORIGINS, '>', "$path_reports/$file_html_origins" ;
31583222
31593223 $html = $header ;
@@ -3758,6 +3822,8 @@
37593823
37603824 sub WriteReportScripts
37613825 {
 3826+ &Log ("WriteReportScripts\n") ;
 3827+
37623828 open FILE_HTML_SCRIPTS, '>', "$path_reports/$file_html_scripts" ;
37633829
37643830 $html = $header ;
@@ -3935,6 +4001,8 @@
39364002
39374003 sub WriteReportGoogle
39384004 {
 4005+ &Log ("WriteReportGoogle\n") ;
 4006+
39394007 open FILE_HTML_SEARCH, '>', "$path_reports/$file_html_google" ;
39404008
39414009 $html = $header ;
@@ -4256,6 +4324,8 @@
42574325
42584326 sub WriteReportSkins
42594327 {
 4328+ &Log ("WriteReportSkins\n") ;
 4329+
42604330 open FILE_HTML_SKINS, '>', "$path_reports/$file_html_skins" ;
42614331
42624332 $html = $header ;
@@ -4310,6 +4380,8 @@
43114381
43124382 sub WriteCsvGoogleBots
43134383 {
 4384+ &Log ("WriteCsvGoogleBots\n") ;
 4385+
43144386 open CSV_GOOGLE_BOTS_OUT, '>', "$path_reports/$file_csv_google_bots" ;
43154387 print CSV_GOOGLE_BOTS_OUT "Date Time,Ip Range,Hits\n" ;
43164388 foreach $path_process (@dirs_process)
@@ -4338,6 +4410,8 @@
43394411
43404412 sub WriteCsvBrowserLanguages
43414413 {
 4414+ &Log ("WriteCsvBrowserLanguages\n") ;
 4415+
43424416 open CSV_BROWSER_LANGUAGES, '>', "$path_reports/$file_csv_browser_languages" ;
43434417 print CSV_BROWSER_LANGUAGES "Browser,Languages,Hits\n" ;
43444418 foreach $key (keys_sorted_alpha_asc %browser_languages)
@@ -4347,6 +4421,8 @@
43484422
43494423 sub WriteCsvCountriesTimed
43504424 {
 4425+ &Log ("WriteCsvCountriesTimed: $path_out/$file_csv_countries_timed\n") ;
 4426+
43514427 $multiplier_1000 = 1000 * $multiplier ;
43524428 print "WriteCsvCountriesTimed: $path_out/$file_csv_countries_timed\n" ;
43534429 open CSV_COUNTRIES_TIMED, '>', "$path_out/$file_csv_countries_timed" ;
@@ -4401,7 +4477,8 @@
44024478 # http://www.maxmind.com/app/iso3166 country codes
44034479 sub WriteCsvCountriesGoTo
44044480 {
4405 - print "WriteCsvCountriesGoTo: $path_out/$file_csv_countries_languages_visited\n" ;
 4481+ &Log ("WriteCsvCountriesGoTo: $path_out/$file_csv_countries_languages_visited\n") ;
 4482+
44064483 open CSV_COUNTRIES_LANGUAGES_VISITED, '>', "$path_out/$file_csv_countries_languages_visited" ;
44074484
44084485 foreach $country (sort keys %countries)
@@ -4465,7 +4542,7 @@
44664543
44674544 sub WriteReportPerLanguageBreakDown
44684545 {
4469 - print "\nWriteReportPerLanguageBreakDown\n" ;
 4546+ &Log ("WriteReportPerLanguageBreakDown\n") ;
44704547
44714548 my ($title,$views_edits,$links) = @_ ;
44724549 my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ;
@@ -4573,7 +4650,7 @@
45744651
45754652 sub WriteReportPerCountryOverview
45764653 {
4577 - print "\nWriteReportPerCountryOverview\n" ;
 4654+ &Log ("WriteReportPerCountryOverview\n") ;
45784655
45794656 my ($title,$views_edits,$links) = @_ ;
45804657 my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ;
@@ -4876,8 +4953,10 @@
48774954
48784955 sub WriteCsvSvgFilePerCountryOverview
48794956 {
4880 - my ($views_edits, $period, $ref_requests_per_period_per_country_code, $max_requests_per_connected_us, $desc_animation) = @_ ;
 4957+ &Log ("WriteCsvSvgFilePerCountryOverview\n") ;
48814958
 4959+ my ($views_edits, $period, $ref_requests_per_period_per_country_code, $max_requests_per_connected_user, $desc_animation) = @_ ;
 4960+
48824961 my %requests_per_country_code = %{$ref_requests_per_period_per_country_code -> {$period}} ;
48834962 my %requests_per_country_code_prev = %{$ref_requests_per_period_per_country_code -> {$period_prev}} ;
48844963 $period_prev = $period ;
@@ -4886,7 +4965,6 @@
48874966 my $postfix = $descriptions_per_period {$period} ;
48884967 # $test = join '', sort values %requests_per_country_code ;
48894968 # print $test . "\n\n" ;
4890 - print "\nWriteCsvSvgFilePerCountryOverview\n" ;
48914969
48924970 my ($link_country,$country,$code,$population,$connected,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot,$requests_max,$requests_this_country,$requests_this_country2) ;
48934971 my (@index_countries,@csv_countries,%svg_groups,%percentage_of_total_pageviews,%requests_per_connected_persons) ;
@@ -4908,11 +4986,11 @@
49094987 # $requests_tot += $requests_per_country_code {$country_code} ;
49104988 # }
49114989
4912 -# die "\$requests_cnt == 0" if $requests_cnt == 0 ;
 4990+# abort ("\$requests_cnt == 0") if $requests_cnt == 0 ;
49134991 # $requests_avg = $requests_tot / $requests_cnt ;
49144992 # print "requests cnt: $requests_cnt, tot: $requests_tot, avg: $requests_avg\n" ;
49154993
4916 -# die "\$requests_avg == 0" if $requests_avg == 0 ;
 4994+# abort ("\$requests_avg == 0") if $requests_avg == 0 ;
49174995 # foreach $country_code (keys %requests_per_country_code)
49184996 # { $requests_per_country_code {$country_code} *= 100/$requests_avg ; }
49194997 # # normalize complete
@@ -5104,6 +5182,8 @@
51055183
51065184 sub WriteWorldMapSvg
51075185 {
 5186+ &Log ("WriteWorldMapSvg\n") ;
 5187+
51085188 ($period, $description) = @_ ;
51095189
51105190 open SVG_IN, "world_map_blank_plain2.svg" ;
@@ -5115,7 +5195,7 @@
51165196 # { $line =~ s/COUNTRY_STYLES/$svg_text/ ; }
51175197
51185198 ($text1,$text2) = split ' - ', $description ;
5119 - print "Animation description: $description -> $text1 | $text2\n" ;
 5199+ &Log ("Animation description: $description -> $text1 | $text2\n") ;
51205200
51215201 $lines = join '', @lines ;
51225202 $lines =~ s/<circle[^>]*?>//gs ;
@@ -5186,7 +5266,7 @@
51875267 }
51885268 close SVG_OUT ;
51895269
5190 - print "Convert world_map_$period.svg to png\n" ;
 5270+ &Log ("Convert world_map_$period.svg to png\n") ;
51915271 `svg/convert.exe svg/world_map_$period.svg png:svg/world_map_$period.png` ;
51925272 # print "Convert world_map_$period.svg to jpg\n" ;
51935273 # `svg/convert.exe svg/world_map_$period.svg jpg:svg/world_map_$period.jpg` ;
@@ -5266,7 +5346,7 @@
52675347
52685348 sub WriteReportPerCountryBreakdown
52695349 {
5270 - print "\nWriteReportPerCountryBreakDown\n" ;
 5350+ &Log ("WriteReportPerCountryBreakDown\n") ;
52715351
52725352 my ($title,$views_edits,$links,$cutoff_requests, $cutoff_percentage, $show_logcount) = @_ ;
52735353 my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ;
@@ -5418,7 +5498,7 @@
54195499
54205500 sub WriteReportPerCountryTrends
54215501 {
5422 - print "\nWriteReportPerCountryTrends\n" ;
 5502+ &Log ("WriteReportPerCountryTrends\n") ;
54235503
54245504 my ($title,$views_edits,$links) = @_ ;
54255505 my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ;
@@ -5672,6 +5752,8 @@
56735753
56745754 sub InitProjectNames
56755755 {
 5756+ &Log ("InitProjectNames\n") ;
 5757+
56765758 # copied from WikiReports.pl
56775759
56785760 %wikipedias = (
@@ -6023,7 +6105,7 @@
60246106
60256107 sub ReadWikipedia
60266108 {
6027 - print "ReadWikipedia\n\n" ;
 6109+ &Log ("ReadWikipedia\n") ;
60286110
60296111 use LWP::Simple qw($ua get);
60306112
@@ -6031,9 +6113,9 @@
60326114 $ua->timeout(60);
60336115
60346116
6035 - print "Read List_of_countries_by_population\n\n" ;
 6117+ &Log ("Read List_of_countries_by_population\n\n") ;
60366118 my $url = 'http://en.wikipedia.org/wiki/List_of_countries_by_population';
6037 - my $html = get $url || die "Timed out!";
 6119+ my $html = get $url || abort ("Timed out!") ;
60386120
60396121 # open TEST, '<', 'List_of_countries_by_population.html' ;
60406122 # @lines = <TEST> ;
@@ -6095,10 +6177,10 @@
60966178 $countries {$country} = "$country,$link,$population,connected,$icon\n" ;
60976179 }
60986180
6099 - print "List_of_countries_by_number_of_Internet_users\n\n" ;
 6181+ &Log ("List_of_countries_by_number_of_Internet_users\n\n") ;
61006182
61016183 $url = 'http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users';
6102 - $html = get $url || die "Timed out!";
 6184+ $html = get $url || abort ("Timed out!") ;
61036185
61046186 # split file on <tr>'s, remove all behind </tr>
61056187 $html =~ s/\n/\\n/gs ;
@@ -6163,7 +6245,7 @@
61646246 if ($country_meta_info {$country} eq "")
61656247 {
61666248 if ($country_meta_info_not_found_reported {$country} ++ == 0)
6167 - { print "Meta info not found for country '$country'\n" ; }
 6249+ { &Log ("Meta info not found for country '$country'\n") ; }
61686250 $link_country = $country ;
61696251 return ($country,'','..','..') ;
61706252 }

Status & tagging log