Index: trunk/wikistats/squids/SquidReportArchive.pl |
— | — | @@ -38,13 +38,13 @@ |
39 | 39 | |
40 | 40 | if (-d "/a/squid") |
41 | 41 | { |
42 | | - print "\n\nJob runs on server $hostname\n\n" ; |
| 42 | + &Log ("\n\nJob runs on server $hostname\n\n") ; |
43 | 43 | $path_in = "/a/ezachte" ; |
44 | 44 | $path_out = "/a/ezachte" ; |
45 | 45 | } |
46 | 46 | elsif ($hostname eq 'bayes') |
47 | 47 | { |
48 | | - print "\n\nJob runs on server $hostname\n\n" ; |
| 48 | + &Log ("\n\nJob runs on server $hostname\n\n") ; |
49 | 49 | $path_in = "/home/ezachte/wikistats/animation" ; |
50 | 50 | $path_out = "/home/ezachte/wikistats/animation" ; |
51 | 51 | } |
— | — | @@ -55,8 +55,8 @@ |
56 | 56 | $path_out = "/srv/erik/" ; |
57 | 57 | } |
58 | 58 | |
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") ; |
61 | 61 | |
62 | 62 | $file_csv_country_meta_info = "SquidReportCountryMetaInfo.csv" ; |
63 | 63 | |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | # 'http://en.wikipedia.org/wiki/List_of_countries_by_population' |
66 | 66 | # 'http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users' |
67 | 67 | if (defined ($options {"w"})) |
68 | | - { &ReadWikipedia ; print "Ready\n" ; exit ; } |
| 68 | + { &ReadWikipedia ; &Log ("Ready\n") ; exit ; } |
69 | 69 | |
70 | 70 | if (defined ($options {"c"})) |
71 | 71 | { $reportcountries = $true ; } |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | if ($quarter_only !~ /^2\d\d\dQ\d$/) |
77 | 77 | { abort ("Specify run for one single quarter as -q yyyyQ[1-4], e.g. -q 2011Q3, not '$quarter_only'\n") ; } |
78 | 78 | $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") ; |
80 | 80 | } |
81 | 81 | |
82 | 82 | # date range used to be read from csv file with ReadDate, now there are daily csv files |
— | — | @@ -84,13 +84,13 @@ |
85 | 85 | |
86 | 86 | &InitProjectNames ; |
87 | 87 | |
88 | | - $file_csv_country_codes = "CountryCodes.csv" ; |
| 88 | + $file_csv_country_codes = "CountryCodes.csv" ; |
89 | 89 | |
90 | 90 | &ReadInputCountriesNames ; |
91 | 91 | |
92 | 92 | if ($reportcountries) |
93 | 93 | { |
94 | | - $project_mode = "wp" ; |
| 94 | + $project_mode = "wp" ; # discard all log data from other projects than Wikipedia |
95 | 95 | |
96 | 96 | &ReadInputCountriesMeta ; |
97 | 97 | |
— | — | @@ -106,14 +106,14 @@ |
107 | 107 | $reportmonth = $options {"m"} ; |
108 | 108 | |
109 | 109 | 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 ; } |
111 | 111 | |
112 | 112 | if ($reportdaysback =~ /^-\d+$/) |
113 | 113 | { |
114 | 114 | ($sec,$min,$hour,$day,$month,$year) = localtime (time+$reportdaysback*86400) ; |
115 | 115 | $reportmonth = sprintf ("%04d-%02d",$year+1900,$month+1) ; |
116 | 116 | } |
117 | | - print "Report month = $reportmonth\n" ; |
| 117 | + &Log ("Report month = $reportmonth\n") ; |
118 | 118 | |
119 | 119 | $threshold_mime = 0 ; |
120 | 120 | $threshold_project = 10 ; |
— | — | @@ -237,9 +237,9 @@ |
238 | 238 | { |
239 | 239 | print "\nDays input = $days_input_found\n" ; |
240 | 240 | $multiplier = 1 / $days_input_found ; |
241 | | - print "\nMultiplier = " . sprintf ("%.4f", $multiplier) . "\n" ; |
| 241 | + &Log ("\nMultiplier = " . sprintf ("%.4f", $multiplier) . "\n") ; |
242 | 242 | } |
243 | | - else { print "\nDays input = 0 (zero!)\n" ; } |
| 243 | + else { &Log ("\nDays input = 0 (zero!)\n") ; } |
244 | 244 | |
245 | 245 | &WriteCsvCountriesTimed ; |
246 | 246 | &WriteCsvCountriesGoTo ; |
— | — | @@ -313,12 +313,13 @@ |
314 | 314 | # &WriteCsvCountriesTargets ; |
315 | 315 | close "FILE_LOG" ; |
316 | 316 | |
317 | | - print "\nReady\n\n" ; |
| 317 | + &Log ("\nReady\n\n") ; |
318 | 318 | exit ; |
319 | 319 | |
320 | 320 | sub ReportCountries |
321 | 321 | { |
322 | 322 | my $mode_report = shift ; |
| 323 | + &Log ("\nReportCountries $mode_report\n\n") ; |
323 | 324 | |
324 | 325 | if ($mode_report eq 'Views') |
325 | 326 | { |
— | — | @@ -398,6 +399,8 @@ |
399 | 400 | |
400 | 401 | sub ReadDate |
401 | 402 | { |
| 403 | + &Log ("ReadDate\n") ; |
| 404 | + |
402 | 405 | open CSV_CRAWLERS, '<', "$path_process/$file_csv_crawlers" ; |
403 | 406 | $line = <CSV_CRAWLERS> ; |
404 | 407 | close CSV_CRAWLERS ; |
— | — | @@ -425,12 +428,14 @@ |
426 | 429 | |
427 | 430 | $timespan = ($timetill - $timefrom) / 3600 ; |
428 | 431 | $multiplier = (24 * 3600) / ($timetill - $timefrom) ; |
429 | | - print "Multiplier = $multiplier\n" ; |
| 432 | + &Log ("Multiplier = $multiplier\n") ; |
430 | 433 | $header =~ s/DATE/Daily averages, based on sample period: $period (yyyy-mm-dd)/ ; |
431 | 434 | } |
432 | 435 | |
433 | 436 | sub SetPeriod |
434 | 437 | { |
| 438 | + &Log ("SetPeriod\n") ; |
| 439 | + |
435 | 440 | $year_first = substr ($date_first,0,4) ; |
436 | 441 | $month_first = substr ($date_first,5,2) ; |
437 | 442 | $day_first = substr ($date_first,8,2) ; |
— | — | @@ -447,11 +452,13 @@ |
448 | 453 | |
449 | 454 | $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) ; |
450 | 455 | $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") ; |
452 | 457 | } |
453 | 458 | |
454 | 459 | sub PrepHtml |
455 | 460 | { |
| 461 | + &Log ("\nPrepHtml\n\n") ; |
| 462 | + |
456 | 463 | $language = "en" ; |
457 | 464 | $header = "<!DOCTYPE FILE_HTML PUBLIC '-//W3C//DTD FILE_HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>\n" . |
458 | 465 | "<html lang='en'>\n" . |
— | — | @@ -547,6 +554,8 @@ |
548 | 555 | |
549 | 556 | sub ReadCountryCodes |
550 | 557 | { |
| 558 | + &Log ("ReadCountryCodes\n") ; |
| 559 | + |
551 | 560 | open CODES, '<', "$path_in/$file_csv_country_codes" ; |
552 | 561 | while ($line = <CODES>) |
553 | 562 | { |
— | — | @@ -563,6 +572,8 @@ |
564 | 573 | |
565 | 574 | sub ReadInputClients |
566 | 575 | { |
| 576 | + &Log ("ReadInputClients\n") ; |
| 577 | + |
567 | 578 | my $file_csv = "$path_process/$file_csv_clients" ; |
568 | 579 | if (! -e $file_csv) |
569 | 580 | { abort ("Function ReadInputClients: file $file_csv not found!!!") ; } |
— | — | @@ -678,6 +689,8 @@ |
679 | 690 | |
680 | 691 | sub ReadInputCrawlers |
681 | 692 | { |
| 693 | + &Log ("ReadInputCrawlers\n") ; |
| 694 | + |
682 | 695 | my $file_csv = "$path_process/$file_csv_crawlers" ; |
683 | 696 | if (! -e $file_csv) |
684 | 697 | { abort ("Function ReadInputCrawlers: file $file_csv not found!!!\n") ; } |
— | — | @@ -733,6 +746,8 @@ |
734 | 747 | |
735 | 748 | sub ReadInputMethods |
736 | 749 | { |
| 750 | + &Log ("ReadInputMethods\n") ; |
| 751 | + |
737 | 752 | my $file_csv = "$path_process/$file_csv_methods" ; |
738 | 753 | if (! -e $file_csv) |
739 | 754 | { abort ("Function ReadInputMethods: file $file_csv not found!!!") ; } |
— | — | @@ -751,6 +766,8 @@ |
752 | 767 | |
753 | 768 | sub ReadInputMimeTypes |
754 | 769 | { |
| 770 | + &Log ("ReadInputMimeTypes\n") ; |
| 771 | + |
755 | 772 | my $file_csv = "$path_process/$file_csv_requests" ; |
756 | 773 | if (! -e $file_csv) |
757 | 774 | { abort ("Function ReadInputMimeTypes: file $file_csv not found!!!") ; } |
— | — | @@ -838,6 +855,8 @@ |
839 | 856 | |
840 | 857 | sub ReadInputOpSys |
841 | 858 | { |
| 859 | + &Log ("ReadInputOpSys\n") ; |
| 860 | + |
842 | 861 | my $file_csv = "$path_process/$file_csv_opsys" ; |
843 | 862 | if (! -e $file_csv) |
844 | 863 | { abort ("Function ReadInputOpSys: file $file_csv not found!!!") ; } |
— | — | @@ -898,6 +917,8 @@ |
899 | 918 | |
900 | 919 | sub ReadInputOrigins |
901 | 920 | { |
| 921 | + &Log ("ReadInputOrigins\n") ; |
| 922 | + |
902 | 923 | my $file_csv = "$path_process/$file_csv_origins" ; |
903 | 924 | if (! -e $file_csv) |
904 | 925 | { abort ("Function ReadInputOrigins: file $file_csv not found!!!") ; } |
— | — | @@ -981,6 +1002,8 @@ |
982 | 1003 | |
983 | 1004 | sub ReadInputScripts |
984 | 1005 | { |
| 1006 | + &Log ("ReadInputScripts\n") ; |
| 1007 | + |
985 | 1008 | my $file_csv = "$path_process/$file_csv_scripts" ; |
986 | 1009 | if (! -e $file_csv) |
987 | 1010 | { abort ("Function ReadInputScripts: file $file_csv not found!!!") ; } |
— | — | @@ -1081,6 +1104,8 @@ |
1082 | 1105 | |
1083 | 1106 | sub ReadInputGoogle |
1084 | 1107 | { |
| 1108 | + &Log ("ReadInputGoogle\n") ; |
| 1109 | + |
1085 | 1110 | my $file_csv = "$path_process/$file_csv_google" ; |
1086 | 1111 | if (! -e $file_csv) |
1087 | 1112 | { abort ("Function ReadInputGoogle: file $file_csv not found!!!") ; } |
— | — | @@ -1138,6 +1163,8 @@ |
1139 | 1164 | |
1140 | 1165 | sub ReadInputSkins |
1141 | 1166 | { |
| 1167 | + &Log ("ReadInputSkins\n") ; |
| 1168 | + |
1142 | 1169 | my $file_csv = "$path_process/$file_csv_skins" ; |
1143 | 1170 | if (! -e $file_csv) |
1144 | 1171 | { abort ("Function ReadInputSkins: file $file_csv not found!!!") ; } |
— | — | @@ -1159,6 +1186,8 @@ |
1160 | 1187 | |
1161 | 1188 | sub ReadInputIndexPhp |
1162 | 1189 | { |
| 1190 | + &Log ("ReadInputIndexPhp\n") ; |
| 1191 | + |
1163 | 1192 | my $file_csv = "$path_process/$file_csv_indexphp" ; |
1164 | 1193 | if (! -e $file_csv) |
1165 | 1194 | { abort ("Function ReadInputIndexPhp: file $file_csv not found!!!") ; } |
— | — | @@ -1285,6 +1314,8 @@ |
1286 | 1315 | |
1287 | 1316 | sub ReadInputCountriesTimed |
1288 | 1317 | { |
| 1318 | + &Log ("ReadInputCountriesTimed\n") ; |
| 1319 | + |
1289 | 1320 | my $file_csv = "$path_process/public/$file_csv_countries_timed" ; |
1290 | 1321 | if (! -e $file_csv) |
1291 | 1322 | { abort ("Function ReadInputSkins: file $file_csv not found!!! ") ; } |
— | — | @@ -1315,6 +1346,8 @@ |
1316 | 1347 | |
1317 | 1348 | sub ReadInputCountriesNames |
1318 | 1349 | { |
| 1350 | + &Log ("ReadInputCountriesNames\n") ; |
| 1351 | + |
1319 | 1352 | $path_csv_country_codes = "$path_in/$file_csv_country_codes" ; |
1320 | 1353 | if (! -e $path_csv_country_codes) { abort ("Input file $path_csv_country_codes not found!") ; } |
1321 | 1354 | |
— | — | @@ -1356,9 +1389,11 @@ |
1357 | 1390 | |
1358 | 1391 | sub ReadInputCountriesMeta |
1359 | 1392 | { |
| 1393 | + &Log ("ReadInputCountriesMeta\n") ; |
| 1394 | + |
1360 | 1395 | # http://en.wikipedia.org/wiki/List_of_countries_by_population |
1361 | 1396 | # 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") ; |
1363 | 1398 | open COUNTRY_META_INFO, '<', "$path_in/$file_csv_country_meta_info" ; |
1364 | 1399 | binmode COUNTRY_META_INFO ; |
1365 | 1400 | while ($line = <COUNTRY_META_INFO>) |
— | — | @@ -1405,6 +1440,8 @@ |
1406 | 1441 | |
1407 | 1442 | sub CollectRegionCounts |
1408 | 1443 | { |
| 1444 | + &Log ("CollectRegionCounts\n") ; |
| 1445 | + |
1409 | 1446 | my ($country_code, $region_code, $north_south_code, $country_name) ; |
1410 | 1447 | |
1411 | 1448 | foreach $country_code (keys %country_names) |
— | — | @@ -1437,6 +1474,8 @@ |
1438 | 1475 | |
1439 | 1476 | sub ReadInputCountriesMonthly |
1440 | 1477 | { |
| 1478 | + &Log ("ReadInputCountriesMonthly\n") ; |
| 1479 | + |
1441 | 1480 | my $project_mode = shift ; |
1442 | 1481 | |
1443 | 1482 | undef %yyyymm_ ; |
— | — | @@ -1474,7 +1513,7 @@ |
1475 | 1514 | $report_year += 1900 ; |
1476 | 1515 | $report_month ++ ; |
1477 | 1516 | |
1478 | | - print "Process project $project_mode\n\n" ; |
| 1517 | + &Log ("Only process data for project $project_mode (wp=Wikipedia, etc)\n") ; |
1479 | 1518 | |
1480 | 1519 | open CSV_SQUID_COUNTS_MONTHLY, '<', $path_csv_squid_counts_monthly ; |
1481 | 1520 | while ($line = <CSV_SQUID_COUNTS_MONTHLY>) |
— | — | @@ -1547,19 +1586,20 @@ |
1548 | 1587 | $requests_recently_per_language {$language} += $count ; |
1549 | 1588 | } |
1550 | 1589 | } |
| 1590 | + &Log ("$lines lines read from $path_csv_squid_counts_monthly\n") ; |
1551 | 1591 | |
1552 | | - print "\n" ; |
1553 | 1592 | @quarters = keys_sorted_alpha_desc %quarters ; |
1554 | 1593 | foreach $quarter (@quarters) |
1555 | 1594 | { |
1556 | | - print "Quarter $quarter: requests: " . (0+$requests_per_quarter {$quarter}) . "\n" ; |
| 1595 | + &Log ("Quarter $quarter: requests: " . (0+$requests_per_quarter {$quarter}) . "\n") ; |
| 1596 | + |
1557 | 1597 | if ($requests_per_quarter {$quarter} == 0) |
1558 | 1598 | { abort ("No known requests found for quarter $quarter") ; } |
1559 | 1599 | } |
1560 | | - print "\n" ; |
| 1600 | + &Log ("\n") ; |
1561 | 1601 | |
1562 | 1602 | $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") ; } |
1564 | 1604 | |
1565 | 1605 | $requests_recently_start = substr ($requests_recently_start,0,4) . '/' . substr ($requests_recently_start,5,2); |
1566 | 1606 | $requests_recently_stop = substr ($requests_recently_stop ,0,4) . '/' . substr ($requests_recently_stop ,5,2) ; |
— | — | @@ -1591,6 +1631,8 @@ |
1592 | 1632 | |
1593 | 1633 | sub ReadInputCountriesDaily |
1594 | 1634 | { |
| 1635 | + &Log ("ReadInputCountriesDaily\n") ; |
| 1636 | + |
1595 | 1637 | # http://en.wikipedia.org/wiki/List_of_countries_by_population |
1596 | 1638 | # http://en.wikipedia.org/wiki/List_of_countries_by_number_of_Internet_users |
1597 | 1639 | |
— | — | @@ -1617,7 +1659,7 @@ |
1618 | 1660 | $report_year += 1900 ; |
1619 | 1661 | $report_month ++ ; |
1620 | 1662 | |
1621 | | - print "Process project $project_mode\n\n" ; |
| 1663 | + &Log ("Process project $project_mode\n\n") ; |
1622 | 1664 | |
1623 | 1665 | $yyyymmdd_prev = "" ; |
1624 | 1666 | open CSV_SQUID_COUNTS_DAILY, '<', $path_csv_squid_counts_daily ; |
— | — | @@ -1626,7 +1668,7 @@ |
1627 | 1669 | chomp $line ; |
1628 | 1670 | ($yyyymmdd,$project,$language,$code,$bot,$count) = split (',', $line) ; |
1629 | 1671 | |
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 ; |
1631 | 1673 | $yyyymmdd_prev = $yyyymmdd ; |
1632 | 1674 | |
1633 | 1675 | ($code,$language) = &NormalizeSquidInput ($code,$language) ; |
— | — | @@ -1715,13 +1757,15 @@ |
1716 | 1758 | print TRACE sort @trace ; |
1717 | 1759 | close TRACE ; |
1718 | 1760 | |
1719 | | - # die "\$connected_us == 0" if $connected_us == 0 ; |
| 1761 | + # abort ("\$connected_us == 0") if $connected_us == 0 ; |
1720 | 1762 | if ($connected_us > 0) |
1721 | 1763 | { $max_requests_per_connected_us_week = sprintf ("%.1f", (($max_requests_per_week_us * 1000) / $connected_us)) ; } |
1722 | 1764 | } |
1723 | 1765 | |
1724 | 1766 | sub NormalizeSquidInput |
1725 | 1767 | { |
| 1768 | +# &Log ("NormalizeSquidInput\n") ; |
| 1769 | + |
1726 | 1770 | my ($code,$language) = @_ ; |
1727 | 1771 | |
1728 | 1772 | if ($language eq "jp") { $language = "ja" ; } |
— | — | @@ -1742,6 +1786,8 @@ |
1743 | 1787 | |
1744 | 1788 | sub DiscardSquidInput |
1745 | 1789 | { |
| 1790 | +# &Log ("DiscardSquidInput\n") ; |
| 1791 | + |
1746 | 1792 | ($bot,$project,$project_mode,$code,$language) = @_ ; |
1747 | 1793 | if ($bot ne "U" or # user |
1748 | 1794 | $project ne $project_mode or # eg 'wp' |
— | — | @@ -1775,6 +1821,8 @@ |
1776 | 1822 | |
1777 | 1823 | sub ReadInputBrowserLanguages |
1778 | 1824 | { |
| 1825 | + &Log ("ReadInputBrowserLanguages\n") ; |
| 1826 | + |
1779 | 1827 | my $file_csv = "$path_process/$file_csv_browser_languages" ; |
1780 | 1828 | if (! -e $file_csv) |
1781 | 1829 | { abort ("Function ReadInputBrowserLanguages: file $file_csv not found!!! ") ; } |
— | — | @@ -1794,6 +1842,8 @@ |
1795 | 1843 | |
1796 | 1844 | sub CalcPercentages |
1797 | 1845 | { |
| 1846 | + &Log ("CalcPercentages\n") ; |
| 1847 | + |
1798 | 1848 | my $total_opsys = $total_opsys_mobile + $total_opsys_non_mobile ; |
1799 | 1849 | my $total_opsys_html_only = $total_opsys_mobile_html_only + $total_opsys_non_mobile_html_only ; |
1800 | 1850 | foreach $key (keys %opsys) |
— | — | @@ -1835,7 +1885,8 @@ |
1836 | 1886 | |
1837 | 1887 | sub NormalizeCounts |
1838 | 1888 | { |
1839 | | -# ReadInputClients |
| 1889 | + &Log ("NormalizeCounts\n") ; |
| 1890 | + |
1840 | 1891 | foreach $key (keys %engines) |
1841 | 1892 | { $engines {$key} = &Normalize ($engines {$key}) ; } |
1842 | 1893 | |
— | — | @@ -1982,6 +2033,8 @@ |
1983 | 2034 | |
1984 | 2035 | sub SortCounts |
1985 | 2036 | { |
| 2037 | + &Log ("SortCounts\n") ; |
| 2038 | + |
1986 | 2039 | # ReadInputClients |
1987 | 2040 | # @engines_sorted_count = keys_sorted_by_value_num_desc %engines ; |
1988 | 2041 | @engines_sorted_alpha = keys_sorted_alpha_asc %engines ; |
— | — | @@ -2045,7 +2098,8 @@ |
2046 | 2099 | |
2047 | 2100 | sub WriteReportClients |
2048 | 2101 | { |
2049 | | - print "\nWriteReportClients -> $path_reports/$file_html_clients\n\n" ; |
| 2102 | + &Log ("WriteReportClients -> $path_reports/$file_html_clients\n") ; |
| 2103 | + |
2050 | 2104 | open FILE_HTML_CLIENTS, '>', "$path_reports/$file_html_clients" ; |
2051 | 2105 | |
2052 | 2106 | $html = $header ; |
— | — | @@ -2514,6 +2568,8 @@ |
2515 | 2569 | |
2516 | 2570 | sub WriteReportCrawlers |
2517 | 2571 | { |
| 2572 | + &Log ("WriteReportCrawlers\n") ; |
| 2573 | + |
2518 | 2574 | open FILE_HTML_CRAWLERS, '>', "$path_reports/$file_html_crawlers" ; |
2519 | 2575 | |
2520 | 2576 | $html = $header ; |
— | — | @@ -2688,6 +2744,8 @@ |
2689 | 2745 | |
2690 | 2746 | sub WriteReportMethods |
2691 | 2747 | { |
| 2748 | + &Log ("WriteReportMethods\n") ; |
| 2749 | + |
2692 | 2750 | open FILE_HTML_METHODS, '>', "$path_reports/$file_html_methods" ; |
2693 | 2751 | |
2694 | 2752 | $html = $header ; |
— | — | @@ -2768,6 +2826,8 @@ |
2769 | 2827 | |
2770 | 2828 | sub WriteReportMimeTypes |
2771 | 2829 | { |
| 2830 | + &Log ("WriteReportMimeTypes\n") ; |
| 2831 | + |
2772 | 2832 | open FILE_HTML_REQUESTS, '>', "$path_reports/$file_html_requests" ; |
2773 | 2833 | |
2774 | 2834 | $html = $header ; |
— | — | @@ -2938,6 +2998,8 @@ |
2939 | 2999 | |
2940 | 3000 | sub WriteReportOpSys |
2941 | 3001 | { |
| 3002 | + &Log ("WriteReportOpSys\n") ; |
| 3003 | + |
2942 | 3004 | open FILE_HTML_OPSYS, '>', "$path_reports/$file_html_opsys" ; |
2943 | 3005 | |
2944 | 3006 | $html = $header ; |
— | — | @@ -3153,6 +3215,8 @@ |
3154 | 3216 | # http://en.wikipedia.org/wiki/Domain_name |
3155 | 3217 | sub WriteReportOrigins |
3156 | 3218 | { |
| 3219 | + &Log ("WriteReportOrigins\n") ; |
| 3220 | + |
3157 | 3221 | open FILE_HTML_ORIGINS, '>', "$path_reports/$file_html_origins" ; |
3158 | 3222 | |
3159 | 3223 | $html = $header ; |
— | — | @@ -3758,6 +3822,8 @@ |
3759 | 3823 | |
3760 | 3824 | sub WriteReportScripts |
3761 | 3825 | { |
| 3826 | + &Log ("WriteReportScripts\n") ; |
| 3827 | + |
3762 | 3828 | open FILE_HTML_SCRIPTS, '>', "$path_reports/$file_html_scripts" ; |
3763 | 3829 | |
3764 | 3830 | $html = $header ; |
— | — | @@ -3935,6 +4001,8 @@ |
3936 | 4002 | |
3937 | 4003 | sub WriteReportGoogle |
3938 | 4004 | { |
| 4005 | + &Log ("WriteReportGoogle\n") ; |
| 4006 | + |
3939 | 4007 | open FILE_HTML_SEARCH, '>', "$path_reports/$file_html_google" ; |
3940 | 4008 | |
3941 | 4009 | $html = $header ; |
— | — | @@ -4256,6 +4324,8 @@ |
4257 | 4325 | |
4258 | 4326 | sub WriteReportSkins |
4259 | 4327 | { |
| 4328 | + &Log ("WriteReportSkins\n") ; |
| 4329 | + |
4260 | 4330 | open FILE_HTML_SKINS, '>', "$path_reports/$file_html_skins" ; |
4261 | 4331 | |
4262 | 4332 | $html = $header ; |
— | — | @@ -4310,6 +4380,8 @@ |
4311 | 4381 | |
4312 | 4382 | sub WriteCsvGoogleBots |
4313 | 4383 | { |
| 4384 | + &Log ("WriteCsvGoogleBots\n") ; |
| 4385 | + |
4314 | 4386 | open CSV_GOOGLE_BOTS_OUT, '>', "$path_reports/$file_csv_google_bots" ; |
4315 | 4387 | print CSV_GOOGLE_BOTS_OUT "Date Time,Ip Range,Hits\n" ; |
4316 | 4388 | foreach $path_process (@dirs_process) |
— | — | @@ -4338,6 +4410,8 @@ |
4339 | 4411 | |
4340 | 4412 | sub WriteCsvBrowserLanguages |
4341 | 4413 | { |
| 4414 | + &Log ("WriteCsvBrowserLanguages\n") ; |
| 4415 | + |
4342 | 4416 | open CSV_BROWSER_LANGUAGES, '>', "$path_reports/$file_csv_browser_languages" ; |
4343 | 4417 | print CSV_BROWSER_LANGUAGES "Browser,Languages,Hits\n" ; |
4344 | 4418 | foreach $key (keys_sorted_alpha_asc %browser_languages) |
— | — | @@ -4347,6 +4421,8 @@ |
4348 | 4422 | |
4349 | 4423 | sub WriteCsvCountriesTimed |
4350 | 4424 | { |
| 4425 | + &Log ("WriteCsvCountriesTimed: $path_out/$file_csv_countries_timed\n") ; |
| 4426 | + |
4351 | 4427 | $multiplier_1000 = 1000 * $multiplier ; |
4352 | 4428 | print "WriteCsvCountriesTimed: $path_out/$file_csv_countries_timed\n" ; |
4353 | 4429 | open CSV_COUNTRIES_TIMED, '>', "$path_out/$file_csv_countries_timed" ; |
— | — | @@ -4401,7 +4477,8 @@ |
4402 | 4478 | # http://www.maxmind.com/app/iso3166 country codes |
4403 | 4479 | sub WriteCsvCountriesGoTo |
4404 | 4480 | { |
4405 | | - print "WriteCsvCountriesGoTo: $path_out/$file_csv_countries_languages_visited\n" ; |
| 4481 | + &Log ("WriteCsvCountriesGoTo: $path_out/$file_csv_countries_languages_visited\n") ; |
| 4482 | + |
4406 | 4483 | open CSV_COUNTRIES_LANGUAGES_VISITED, '>', "$path_out/$file_csv_countries_languages_visited" ; |
4407 | 4484 | |
4408 | 4485 | foreach $country (sort keys %countries) |
— | — | @@ -4465,7 +4542,7 @@ |
4466 | 4543 | |
4467 | 4544 | sub WriteReportPerLanguageBreakDown |
4468 | 4545 | { |
4469 | | - print "\nWriteReportPerLanguageBreakDown\n" ; |
| 4546 | + &Log ("WriteReportPerLanguageBreakDown\n") ; |
4470 | 4547 | |
4471 | 4548 | my ($title,$views_edits,$links) = @_ ; |
4472 | 4549 | my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ; |
— | — | @@ -4573,7 +4650,7 @@ |
4574 | 4651 | |
4575 | 4652 | sub WriteReportPerCountryOverview |
4576 | 4653 | { |
4577 | | - print "\nWriteReportPerCountryOverview\n" ; |
| 4654 | + &Log ("WriteReportPerCountryOverview\n") ; |
4578 | 4655 | |
4579 | 4656 | my ($title,$views_edits,$links) = @_ ; |
4580 | 4657 | my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ; |
— | — | @@ -4876,8 +4953,10 @@ |
4877 | 4954 | |
4878 | 4955 | sub WriteCsvSvgFilePerCountryOverview |
4879 | 4956 | { |
4880 | | - my ($views_edits, $period, $ref_requests_per_period_per_country_code, $max_requests_per_connected_us, $desc_animation) = @_ ; |
| 4957 | + &Log ("WriteCsvSvgFilePerCountryOverview\n") ; |
4881 | 4958 | |
| 4959 | + my ($views_edits, $period, $ref_requests_per_period_per_country_code, $max_requests_per_connected_user, $desc_animation) = @_ ; |
| 4960 | + |
4882 | 4961 | my %requests_per_country_code = %{$ref_requests_per_period_per_country_code -> {$period}} ; |
4883 | 4962 | my %requests_per_country_code_prev = %{$ref_requests_per_period_per_country_code -> {$period_prev}} ; |
4884 | 4963 | $period_prev = $period ; |
— | — | @@ -4886,7 +4965,6 @@ |
4887 | 4966 | my $postfix = $descriptions_per_period {$period} ; |
4888 | 4967 | # $test = join '', sort values %requests_per_country_code ; |
4889 | 4968 | # print $test . "\n\n" ; |
4890 | | - print "\nWriteCsvSvgFilePerCountryOverview\n" ; |
4891 | 4969 | |
4892 | 4970 | 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) ; |
4893 | 4971 | my (@index_countries,@csv_countries,%svg_groups,%percentage_of_total_pageviews,%requests_per_connected_persons) ; |
— | — | @@ -4908,11 +4986,11 @@ |
4909 | 4987 | # $requests_tot += $requests_per_country_code {$country_code} ; |
4910 | 4988 | # } |
4911 | 4989 | |
4912 | | -# die "\$requests_cnt == 0" if $requests_cnt == 0 ; |
| 4990 | +# abort ("\$requests_cnt == 0") if $requests_cnt == 0 ; |
4913 | 4991 | # $requests_avg = $requests_tot / $requests_cnt ; |
4914 | 4992 | # print "requests cnt: $requests_cnt, tot: $requests_tot, avg: $requests_avg\n" ; |
4915 | 4993 | |
4916 | | -# die "\$requests_avg == 0" if $requests_avg == 0 ; |
| 4994 | +# abort ("\$requests_avg == 0") if $requests_avg == 0 ; |
4917 | 4995 | # foreach $country_code (keys %requests_per_country_code) |
4918 | 4996 | # { $requests_per_country_code {$country_code} *= 100/$requests_avg ; } |
4919 | 4997 | # # normalize complete |
— | — | @@ -5104,6 +5182,8 @@ |
5105 | 5183 | |
5106 | 5184 | sub WriteWorldMapSvg |
5107 | 5185 | { |
| 5186 | + &Log ("WriteWorldMapSvg\n") ; |
| 5187 | + |
5108 | 5188 | ($period, $description) = @_ ; |
5109 | 5189 | |
5110 | 5190 | open SVG_IN, "world_map_blank_plain2.svg" ; |
— | — | @@ -5115,7 +5195,7 @@ |
5116 | 5196 | # { $line =~ s/COUNTRY_STYLES/$svg_text/ ; } |
5117 | 5197 | |
5118 | 5198 | ($text1,$text2) = split ' - ', $description ; |
5119 | | - print "Animation description: $description -> $text1 | $text2\n" ; |
| 5199 | + &Log ("Animation description: $description -> $text1 | $text2\n") ; |
5120 | 5200 | |
5121 | 5201 | $lines = join '', @lines ; |
5122 | 5202 | $lines =~ s/<circle[^>]*?>//gs ; |
— | — | @@ -5186,7 +5266,7 @@ |
5187 | 5267 | } |
5188 | 5268 | close SVG_OUT ; |
5189 | 5269 | |
5190 | | - print "Convert world_map_$period.svg to png\n" ; |
| 5270 | + &Log ("Convert world_map_$period.svg to png\n") ; |
5191 | 5271 | `svg/convert.exe svg/world_map_$period.svg png:svg/world_map_$period.png` ; |
5192 | 5272 | # print "Convert world_map_$period.svg to jpg\n" ; |
5193 | 5273 | # `svg/convert.exe svg/world_map_$period.svg jpg:svg/world_map_$period.jpg` ; |
— | — | @@ -5266,7 +5346,7 @@ |
5267 | 5347 | |
5268 | 5348 | sub WriteReportPerCountryBreakdown |
5269 | 5349 | { |
5270 | | - print "\nWriteReportPerCountryBreakDown\n" ; |
| 5350 | + &Log ("WriteReportPerCountryBreakDown\n") ; |
5271 | 5351 | |
5272 | 5352 | my ($title,$views_edits,$links,$cutoff_requests, $cutoff_percentage, $show_logcount) = @_ ; |
5273 | 5353 | my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ; |
— | — | @@ -5418,7 +5498,7 @@ |
5419 | 5499 | |
5420 | 5500 | sub WriteReportPerCountryTrends |
5421 | 5501 | { |
5422 | | - print "\nWriteReportPerCountryTrends\n" ; |
| 5502 | + &Log ("WriteReportPerCountryTrends\n") ; |
5423 | 5503 | |
5424 | 5504 | my ($title,$views_edits,$links) = @_ ; |
5425 | 5505 | my ($link_country,$population,$icon,$bar,$bars,$bar_width,$perc,$perc_tot,$perc_global,$requests_tot) ; |
— | — | @@ -5672,6 +5752,8 @@ |
5673 | 5753 | |
5674 | 5754 | sub InitProjectNames |
5675 | 5755 | { |
| 5756 | + &Log ("InitProjectNames\n") ; |
| 5757 | + |
5676 | 5758 | # copied from WikiReports.pl |
5677 | 5759 | |
5678 | 5760 | %wikipedias = ( |
— | — | @@ -6023,7 +6105,7 @@ |
6024 | 6106 | |
6025 | 6107 | sub ReadWikipedia |
6026 | 6108 | { |
6027 | | - print "ReadWikipedia\n\n" ; |
| 6109 | + &Log ("ReadWikipedia\n") ; |
6028 | 6110 | |
6029 | 6111 | use LWP::Simple qw($ua get); |
6030 | 6112 | |
— | — | @@ -6031,9 +6113,9 @@ |
6032 | 6114 | $ua->timeout(60); |
6033 | 6115 | |
6034 | 6116 | |
6035 | | - print "Read List_of_countries_by_population\n\n" ; |
| 6117 | + &Log ("Read List_of_countries_by_population\n\n") ; |
6036 | 6118 | 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!") ; |
6038 | 6120 | |
6039 | 6121 | # open TEST, '<', 'List_of_countries_by_population.html' ; |
6040 | 6122 | # @lines = <TEST> ; |
— | — | @@ -6095,10 +6177,10 @@ |
6096 | 6178 | $countries {$country} = "$country,$link,$population,connected,$icon\n" ; |
6097 | 6179 | } |
6098 | 6180 | |
6099 | | - print "List_of_countries_by_number_of_Internet_users\n\n" ; |
| 6181 | + &Log ("List_of_countries_by_number_of_Internet_users\n\n") ; |
6100 | 6182 | |
6101 | 6183 | $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!") ; |
6103 | 6185 | |
6104 | 6186 | # split file on <tr>'s, remove all behind </tr> |
6105 | 6187 | $html =~ s/\n/\\n/gs ; |
— | — | @@ -6163,7 +6245,7 @@ |
6164 | 6246 | if ($country_meta_info {$country} eq "") |
6165 | 6247 | { |
6166 | 6248 | 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") ; } |
6168 | 6250 | $link_country = $country ; |
6169 | 6251 | return ($country,'','..','..') ; |
6170 | 6252 | } |