r85487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85486‎ | r85487 | r85488 >
Date:23:11, 5 April 2011
Author:ezachte
Status:deferred
Tags:
Comment:
Reorganized and extended set of page view reports
Modified paths:
  • /trunk/wikistats/dumps/WikiCountsSummarizeProjectCounts.pl (modified) (history)
  • /trunk/wikistats/dumps/WikiReports.pl (modified) (history)
  • /trunk/wikistats/dumps/WikiReportsInput.pm (modified) (history)
  • /trunk/wikistats/dumps/WikiReportsOutputMisc.pm (modified) (history)
  • /trunk/wikistats/dumps/WikiReportsOutputSummaries.pm (modified) (history)
  • /trunk/wikistats/dumps/WikiReportsOutputTables.pm (modified) (history)

Diff [purge]

Index: trunk/wikistats/dumps/WikiReports.pl
@@ -28,7 +28,7 @@
2929 # push @arguments, '-v n' ; # generate tables with pageviews per wiki: non-mobile traffic
3030 # e.g. http://stats.wikimedia.org/EN/TablesPageViewsMonthlyMobile.htm
3131 # mutually exclusive with other reporting
32 - push @arguments, '-v c' ; # generate tables with pageviews per wiki: mobile + non-mobile traffic
 32+ # push @arguments, '-v c' ; # generate tables with pageviews per wiki: mobile + non-mobile traffic
3333 # e.g. http://stats.wikimedia.org/EN/TablesPageViewsMonthlyCombined.htm
3434 # mutually exclusive with other reporting
3535 # push @arguments, '-n' ; # normalize monthly page view data (see -v) to 30 days for each month
@@ -39,7 +39,7 @@
4040 # push @arguments, '-c' ; # generate category trees
4141 # mutually exclusive with other reporting
4242
43 - # push @arguments, '-r india' ; # only one region per run, no region specified -> all languages
 43+ push @arguments, '-r india' ; # only one region per run, no region specified -> all languages
4444 # push @arguments, '-r africa' ;
4545 # push @arguments, '-r america' ;
4646 # push @arguments, '-r asia' ;
@@ -206,11 +206,11 @@
207207 else
208208 { &GenerateSiteMap ; }
209209
210 - if ($mode_wp && ($language eq "en"))
211 - {
212 - &LogT ("\nGenerate Summaries Per Wiki") ;
213 - &GenerateSummariesPerWiki ;
214 - }
 210+ if ($mode_wp && ($language eq "en"))
 211+ {
 212+ &LogT ("\nGenerate Summaries Per Wiki") ;
 213+ &GenerateSummariesPerWiki ;
 214+ }
215215
216216 # &GenerateTablesPerWiki ("zz") ;
217217 # &GenerateComparisonTables ;
@@ -257,7 +257,7 @@
258258 &LogT ("\nGenerate Comparison Tables") ;
259259 &GenerateComparisonTables ;
260260
261 -# $showplots = $false ; # for test only
 261+ # $showplots = $false ; # for test only
262262
263263 if ($showplots)
264264 {
@@ -270,16 +270,19 @@
271271 &GeneratePlotFiles ;
272272 }
273273
274 - &LogT ("\nGenerate Wiki Specific Tables") ;
275 - &GenerateWikiSpecificTables ;
276 - if ($mode_wp)
277 - { &GenerateTablesPerWiki ("zzz") ; }
 274+ if ((! $mode_wp) || ($region eq ''))
 275+ {
 276+ &LogT ("\nGenerate Wiki Specific Tables") ;
 277+ &GenerateWikiSpecificTables ;
 278+ if ($mode_wp)
 279+ { &GenerateTablesPerWiki ("zzz") ; }
278280
279 - &LogT ("\nGenerate Wikipedia Specific Charts" ) ;
280 - foreach $wp (@languages)
281 - { &GenerateChartsPerWikipedia ($wp) ; }
282 - if ($mode_wp)
283 - { &GenerateChartsPerWikipedia ("zzz") ; }
 281+ &LogT ("\nGenerate Wikipedia Specific Charts" ) ;
 282+ foreach $wp (@languages)
 283+ { &GenerateChartsPerWikipedia ($wp) ; }
 284+ if ($mode_wp)
 285+ { &GenerateChartsPerWikipedia ("zzz") ; }
 286+ }
284287
285288 # &GenerateChartsPerWikipedia ("zz") ;
286289 # &GenerateChartsPerWikipedia ("en") ;
Index: trunk/wikistats/dumps/WikiReportsOutputSummaries.pm
@@ -173,33 +173,33 @@
174174
175175 # page views
176176
177 - $daysinmonth = days_in_month (substr ($mmddyyyy,6,4), substr ($mmddyyyy,0,2)) ;
178 - $pageviews = sprintf ("%.0f", ($PageViewsPerHour {$wp} * 24 * 30)) ; # use normalized count (month always 30 days)
179 - $pageviews_day = $pageviews / 30 ; # $daysinmonth ;
180 - $pageviews_hour = $pageviews_day / 24 ;
181 - $pageviews_min = $pageviews_day / (24 * 60) ;
182 - $pageviews_sec = $pageviews_day / (24 * 60 * 60) ;
 177+ $daysinmonth = days_in_month (substr ($mmddyyyy,6,4), substr ($mmddyyyy,0,2)) ;
 178+ $pageviews_month = sprintf ("%.0f", ($PageViewsPerHour {$wp} * 24 * 30)) ; # use normalized count (month always 30 days)
 179+ $pageviews_day = $pageviews_month / 30 ; # $daysinmonth ;
 180+ $pageviews_hour = $pageviews_day / 24 ;
 181+ $pageviews_min = $pageviews_day / (24 * 60) ;
 182+ $pageviews_sec = $pageviews_day / (24 * 60 * 60) ;
183183
184 - $this_month = $pageviews ;
 184+ $this_month = $pageviews_month ;
185185 $metric_PV_yearly = "--" ;
186186 $metric_PV_monthly = "--" ;
187187
188 - print "DAYSINMONTH $month_year: $daysinmonth, PAGEVIEWS $pageviews\n" ;
 188+ print "DAYSINMONTH $month_year: $daysinmonth, PAGEVIEWS $pageviews_month\n" ;
189189
190190 $metric_PV_data = &FormatSummary ($this_month) ;
191191
192 - $pageviews = &format($pageviews,'X') ;
193 - $pageviews_day = &format($pageviews_day,'X') ;
194 - $pageviews_hour = &format($pageviews_hour,'X') ;
195 - $pageviews_min = &format($pageviews_min,'X') ;
196 - $pageviews_sec = &format($pageviews_sec,'X') ;
 192+ $pageviews_month = &format($pageviews_month,'X') ;
 193+ $pageviews_day = &format($pageviews_day,'X') ;
 194+ $pageviews_hour = &format($pageviews_hour,'X') ;
 195+ $pageviews_min = &format($pageviews_min,'X') ;
 196+ $pageviews_sec = &format($pageviews_sec,'X') ;
197197
198198 if ($pageviews_sec >= 1)
199 - { $pageviews_per_unit = "$pageviews/month = $pageviews_day /day = $pageviews_hour /hour = $pageviews_min /minute = $pageviews_sec /second" ; }
 199+ { $pageviews_per_unit = "$pageviews_month/month = $pageviews_day /day = $pageviews_hour /hour = $pageviews_min /minute = $pageviews_sec /second" ; }
200200 elsif ($pageviews_min >= 1)
201 - { $pageviews_per_unit = "$pageviews/month = $pageviews_day /day = $pageviews_hour /hour = $pageviews_min /minute" ; }
 201+ { $pageviews_per_unit = "$pageviews_month/month = $pageviews_day /day = $pageviews_hour /hour = $pageviews_min /minute" ; }
202202 else
203 - { $pageviews_per_unit = "$pageviews/month = $pageviews_day /day = $pageviews_hour /hour " ; }
 203+ { $pageviews_per_unit = "$pageviews_month/month = $pageviews_day /day = $pageviews_hour /hour " ; }
204204 $pageviews_per_unit =~ s/M/million/g ;
205205 $pageviews_per_unit =~ s/k/thousand/g ;
206206 $pageviews_per_unit =~ s/\// per /g ;
Index: trunk/wikistats/dumps/WikiReportsOutputTables.pm
@@ -3180,34 +3180,37 @@
31813181
31823182 my $content = &GenerateHtmlStartComparisonTables ($f, $normalize_days_per_month) ;
31833183
3184 - if ($pageviews_mobile)
 3184+ if ($pageviews)
31853185 {
3186 - $href_normalized = 'TablesPageViewsMonthlyMobile.htm' ;
3187 - $href_not_normalized = 'TablesPageViewsMonthlyOriginalMobile.htm' ;
3188 - }
3189 - elsif ($pageviews_non_mobile)
3190 - {
3191 - $href_normalized = 'TablesPageViewsMonthly.htm' ;
3192 - $href_not_normalized = 'TablesPageViewsMonthlyOriginal.htm' ;
3193 - }
3194 - else
3195 - {
3196 - $href_normalized = 'TablesPageViewsMonthlyCombined.htm' ;
3197 - $href_not_normalized = 'TablesPageViewsMonthlyOriginalCombined.htm' ;
3198 - }
3199 - $href_normalized2 = 'TablesPageViewsMonthlyCombined.htm' ;
3200 - $href_not_normalized2 = 'TablesPageViewsMonthlyOriginalCombined.htm' ;
 3186+ if ($pageviews_mobile)
 3187+ {
 3188+ $href_normalized = 'TablesPageViewsMonthlyMobile.htm' ;
 3189+ $href_not_normalized = 'TablesPageViewsMonthlyOriginalMobile.htm' ;
 3190+ }
 3191+ elsif ($pageviews_non_mobile)
 3192+ {
 3193+ $href_normalized = 'TablesPageViewsMonthly.htm' ;
 3194+ $href_not_normalized = 'TablesPageViewsMonthlyOriginal.htm' ;
 3195+ }
 3196+ elsif ($pageviews_combined)
 3197+ {
 3198+ $href_normalized = 'TablesPageViewsMonthlyCombined.htm' ;
 3199+ $href_not_normalized = 'TablesPageViewsMonthlyOriginalCombined.htm' ;
 3200+ }
 3201+ $href_normalized2 = 'TablesPageViewsMonthly.htm' ;
 3202+ $href_not_normalized2 = 'TablesPageViewsMonthlyOriginal.htm' ;
32013203
3202 - if ($normalize_days_per_month)
3203 - {
3204 - $href_current_file = $href_normalized ;
3205 - $href_current_file2 = $href_normalized2 ;
 3204+ if ($normalize_days_per_month)
 3205+ {
 3206+ $href_current_file = $href_normalized ;
 3207+ $href_current_file2 = $href_normalized2 ;
 3208+ }
 3209+ else
 3210+ {
 3211+ $href_current_file = $href_not_normalized ;
 3212+ $href_current_file2 = $href_not_normalized2 ;
 3213+ }
32063214 }
3207 - else
3208 - {
3209 - $href_current_file = $href_not_normalized ;
3210 - $href_current_file2 = $href_not_normalized2 ;
3211 - }
32123215
32133216 if ($wikimedia && ($f <= 1) && $mode_wp)
32143217 {
@@ -3267,6 +3270,9 @@
32683271 $raw_or_not = "Raw Data, " ;
32693272 }
32703273
 3274+ $out_html .= "<p><a href='http://stats.wikimedia.org/EN/TablesPageViewsSitemap.htm'>Site map for all page view reports</a><p>" ;
 3275+
 3276+
32713277 if ($normalize_days_per_month)
32723278 {
32733279 $out_html .= "<p>Switch to $coverage1$coverage2<a href='$href_not_normalized'>Raw Data</a>" ;
Index: trunk/wikistats/dumps/WikiCountsSummarizeProjectCounts.pl
@@ -75,6 +75,7 @@
7676 $count = $totals {"month"} {$project} {$key} ;
7777
7878 next if $project eq 'wx' and $lang ne 'commons' ;
 79+
7980 if ($lang eq 'commons')
8081 { $project2 = 'Commons' ; }
8182 elsif ($lang =~ /\.m/)
@@ -89,17 +90,21 @@
9091 $projects3 {$project3}++ ;
9192 $projects3 {'all'}++ ;
9293
93 - $totals_project {"month"} {$project2} {$date} += $count ;
94 - if ($totals_project {"month"} {$project2} {$date} > $totals_project_max {"month"} {$project2})
95 - { $totals_project_max {"month"} {$project2} = $totals_project {"month"} {$project2} {$date} ; }
 94+ # split is mobile or non-mobile
 95+ # combined is mobile plus non-mobile views for one project
 96+ # all = views for all wikis from all projects
9697
97 - $totals_project {"month"} {"$project3"} {$date} += $count ;
98 - if ($totals_project {"month"} {$project3} {$date} > $totals_project_max {"month"} {$project3})
99 - { $totals_project_max {"month"} {$project3} = $totals_project {"month"} {$project3} {$date} ; }
 98+ # $totals_project_month_split {$project2} {$date} += $count ;
 99+ # if ($totals_project_month_split {$project2} {$date} > $totals_project_month_split_max {$project2})
 100+ # { $totals_project_month_split_max {$project2} = $totals_project_month_split {$project2} {$date} ; }
100101
101 - $totals_project {"month"} {'all'} {$date} += $count ;
102 - if ($totals_project {"month"} {'all'} {$date} > $totals_project_max {"month"} {'all'})
103 - { $totals_project_max {"month"} {'all'} = $totals_project {"month"} {'all'} {$date} ; }
 102+ $totals_project_month_combined {"$project3"} {$date} += $count ;
 103+ if ($totals_project_month_combined {$project3} {$date} > $totals_project_month_combined_max {$project3})
 104+ { $totals_project_month_combined_max {$project3} = $totals_project_month_combined {$project3} {$date} ; }
 105+
 106+ $totals_project_month_combined {"all"} {$date} += $count ;
 107+ if ($totals_project_month_combined {"all"} {$date} > $totals_project_month_combined_max {"all"})
 108+ { $totals_project_month_combined_max {"all"} = $totals_project_month_combined {"all"} {$date} ; }
104109 }
105110 }
106111
@@ -304,8 +309,8 @@
305310 my ($month,$year) = (localtime(time))[4,5] ;
306311 my @months = qw(Xxx Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec) ;
307312
308 -# $year = 110 ;
309 -# $month = 12 ;
 313+# $year = 111 ;
 314+# $month = 1 ;
310315
311316 $year_now = $year + 1900 ;
312317 $month_now = $month + 1 ;
@@ -649,7 +654,7 @@
650655 next ;
651656 }
652657
653 - # translate suffixes used in dammit.lt files into project codes often as used in wikistats
 658+ # translate suffixes used in dammit.lt files into project codes as used in wikistats
654659
655660 if ($project eq "") { $project = "wp"; }
656661 elsif ($project eq "b") { $project = "wb"; } # wikibooks
@@ -741,10 +746,10 @@
742747 { $file_csv =~ s/\.csv/Normalized.csv/ ; }
743748 &Log ("File out: $file_out\n") ;
744749
745 - if (-e "$dir_out/PageViewsPerHourAll.csv")
 750+ if (-e "$dir_out/PageViewsPerHourAll.csv") # huge file, remove for now, reactivate when really used
746751 {
747 - print "unlink $dir_out/PageViewsPerHourAll.csv (reactive when really used)\n" ;
748 - unlink "$dir_out/PageViewsPerHourAll.csv" ; # huge, file reactivate when really used
 752+ print "unlink $dir_out/PageViewsPerHourAll.csv (reactivate when really used)\n" ;
 753+ unlink "$dir_out/PageViewsPerHourAll.csv" ;
749754 }
750755
751756 &Log ("File csv: $file_csv\n") ;
@@ -793,6 +798,62 @@
794799 print CSV "=== $msg_normalized ===\n" ;
795800 print "=== $msg_normalized ===\n" ;
796801
 802+ print CSV "\n=== Page view totals non-mobile + mobile ===\n\n" ;
 803+ print "\n=== Page view totals non-mobile + mobile ===\n\n" ;
 804+
 805+ print CSV ",,,,,,,," . $csv_recent_months ;
 806+ print $csv_recent_months ;
 807+
 808+ # write per popular language+wiki recent months of page view totals
 809+ # non mobile + mobile
 810+ $lines = 0 ;
 811+ foreach $line (@totals_lastmonth)
 812+ {
 813+ next if $line =~ /\.m/ ;
 814+
 815+ if (++$lines > $maxpopularwikis) { last ; }
 816+
 817+ ($project, $language) = split (',', $line) ;
 818+ $largest_projects {"$project-$language"} ++ ;
 819+
 820+ $language_name = $out_languages {$language} ;
 821+
 822+ print CSV ",,,,,,,," ;
 823+
 824+ if (($project ne "wp") && ($project ne "wx"))
 825+ {
 826+ print CSV "$language_name " . &GetProjectName ($project) . "," ;
 827+ print "$language_name " . &GetProjectName ($project) . "," ;
 828+ }
 829+ else
 830+ {
 831+ print CSV "$language_name," ;
 832+ print "$language_name," ;
 833+ }
 834+
 835+# %test = %{$totals {"month"} {"wp"} };
 836+# %test2 = @recent_months ;
 837+ for ($m = 0 ; $m < $months_recent ; $m++)
 838+ {
 839+ print CSV ($totals {"month"} {$project} {"$language,${recent_months [$m]}"} +
 840+ $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"}) . "," ;
 841+ print ($totals {"month"} {$project} {"$language,${recent_months [$m]}"} +
 842+ $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"}) . "," ;
 843+ }
 844+
 845+ if (($project ne "wp") && ($project ne "wx"))
 846+ {
 847+ print CSV "$language_name " . &GetProjectName ($project) . "\n" ;
 848+ print "$language_name " . &GetProjectName ($project) . "\n" ;
 849+ }
 850+ else
 851+ {
 852+ print CSV "$language_name\n" ;
 853+ print "$language_name\n" ;
 854+ }
 855+
 856+ }
 857+
797858 print CSV "\n=== Page view totals non-mobile ===\n\n" ;
798859 print "\n=== Page view totals non-mobile ===\n\n" ;
799860
@@ -844,7 +905,6 @@
845906 print CSV "$language_name\n" ;
846907 print "$language_name\n" ;
847908 }
848 -
849909 }
850910
851911 print CSV "\n=== Page view totals mobile ===\n\n" ;
@@ -853,10 +913,10 @@
854914 # write per popular language+wiki recent months of page view totals
855915 # mobile
856916 $lines = 0 ;
 917+
857918 foreach $line (@totals_lastmonth)
858919 {
859920 next if $line !~ /\.m/ ;
860 -
861921 if (++$lines > $maxpopularwikis) { last ; }
862922 ($project, $language) = split (',', $line) ;
863923 $largest_projects {"$project-$language"} ++ ;
@@ -897,156 +957,156 @@
898958 }
899959 }
900960
901 - print CSV "\n=== Page view totals indexed non-mobile ===\n\n" ;
902 - print "\n=== Page view totals indexed non-mobile ===\n\n" ;
 961+# print CSV "\n=== Page view totals indexed non-mobile ===\n\n" ;
 962+# print "\n=== Page view totals indexed non-mobile ===\n\n" ;
903963
904 - print CSV ",,,,,,,," . "$csv_recent_months" ;
905 - print "$csv_recent_months" ;
 964+# print CSV ",,,,,,,," . "$csv_recent_months" ;
 965+# print "$csv_recent_months" ;
906966
907 - # write per popular language+wiki recent months of page view totals, normalized to first month = 100
908 - # non mobile
909 - $lines = 0 ;
910 - foreach $line (@totals_lastmonth)
911 - {
912 - next if $line =~ /\.m/ ;
913 - if (++$lines > $maxpopularwikis) { last ; }
 967+# # write per popular language+wiki recent months of page view totals, normalized to first month = 100
 968+# # non mobile
 969+# $lines = 0 ;
 970+# foreach $line (@totals_lastmonth)
 971+# {
 972+# next if $line =~ /\.m/ ;
 973+# if (++$lines > $maxpopularwikis) { last ; }
914974
915 - ($project, $language) = split (',', $line) ;
916 - $language_name = $out_languages {$language} ;
 975+# ($project, $language) = split (',', $line) ;
 976+# $language_name = $out_languages {$language} ;
917977
918 - if (($project ne "wp") && ($project ne "wx"))
919 - { print CSV ",,,,,,,," . "$language_name " . &GetProjectName ($project) . "," ; }
920 - else
921 - { print CSV ",,,,,,,," . "$language_name," ; }
 978+# if (($project ne "wp") && ($project ne "wx"))
 979+# { print CSV ",,,,,,,," . "$language_name " . &GetProjectName ($project) . "," ; }
 980+# else
 981+# { print CSV ",,,,,,,," . "$language_name," ; }
922982
923 - $recent_month_0 = $totals {"month"} {$project} {"$language,${recent_months [ 0]}"} ;
924 - for ($m = 0 ; $m < $months_recent ; $m++)
925 - {
926 - if ($recent_month_0 > 0)
927 - {
928 - print CSV sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language,${recent_months [$m]}"} / $recent_month_0) . "," ;
929 - print sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language,${recent_months [$m]}"} / $recent_month_0) . "," ;
930 - }
931 - else
932 - {
933 - print CSV "," ;
934 - print "," ;
935 - }
936 - }
 983+# $recent_month_0 = $totals {"month"} {$project} {"$language,${recent_months [ 0]}"} ;
 984+# for ($m = 0 ; $m < $months_recent ; $m++)
 985+# {
 986+# if ($recent_month_0 > 0)
 987+# {
 988+# print CSV sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language,${recent_months [$m]}"} / $recent_month_0) . "," ;
 989+# print sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language,${recent_months [$m]}"} / $recent_month_0) . "," ;
 990+# }
 991+# else
 992+# {
 993+# print CSV "," ;
 994+# print "," ;
 995+# }
 996+# }
937997
938 - if (($project ne "wp") && ($project ne "wx"))
939 - { print CSV "$language_name " . &GetProjectName ($project) . "\n" ; }
940 - else
941 - { print CSV "$language_name\n" ; }
942 - }
 998+# if (($project ne "wp") && ($project ne "wx"))
 999+# { print CSV "$language_name " . &GetProjectName ($project) . "\n" ; }
 1000+# else
 1001+# { print CSV "$language_name\n" ; }
 1002+# }
9431003
944 - print CSV "\n=== Page view totals indexed mobile ===\n\n" ;
945 - print "\n=== Page view totals indexed mobile ===\n\n" ;
 1004+# print CSV "\n=== Page view totals indexed mobile ===\n\n" ;
 1005+# print "\n=== Page view totals indexed mobile ===\n\n" ;
9461006
947 - print CSV ",,,,,,,,,,,,,,,,,,,,,,," . $csv_recent_months ;
948 - print $csv_recent_months ;
 1007+# print CSV ",,,,,,,,,,,,,,,,,,,,,,," . $csv_recent_months ;
 1008+# print $csv_recent_months ;
9491009
950 - # write per popular language+wiki recent months of page view totals, normalized to first month = 100
951 - # mobile
952 - $lines = 0 ;
953 - foreach $line (@totals_lastmonth)
954 - {
955 - next if $line !~ /\.m/ ;
956 - if (++$lines > $maxpopularwikis) { last ; }
 1010+# # write per popular language+wiki recent months of page view totals, normalized to first month = 100
 1011+# # mobile
 1012+# $lines = 0 ;
 1013+# foreach $line (@totals_lastmonth)
 1014+# {
 1015+# next if $line !~ /\.m/ ;
 1016+# if (++$lines > $maxpopularwikis) { last ; }
9571017
958 - ($project, $language) = split (',', $line) ;
959 - ($language,$mobile) = split ('\.', $language) ;
960 - $language_name = $out_languages {$language} ;
961 - if ($mobile eq 'm')
962 - { $language_name .= ' Mobile' ; }
 1018+# ($project, $language) = split (',', $line) ;
 1019+# ($language,$mobile) = split ('\.', $language) ;
 1020+# $language_name = $out_languages {$language} ;
 1021+# if ($mobile eq 'm')
 1022+# { $language_name .= ' Mobile' ; }
9631023
964 - if (($project ne "wp") && ($project ne "wx"))
965 - { print CSV ",,,,,,,,,,,,,,,,,,,,,,," . "$language_name " . &GetProjectName ($project) . "," ; }
966 - else
967 - { print CSV ",,,,,,,,,,,,,,,,,,,,,,," . "$language_name," ; }
 1024+# if (($project ne "wp") && ($project ne "wx"))
 1025+# { print CSV ",,,,,,,,,,,,,,,,,,,,,,," . "$language_name " . &GetProjectName ($project) . "," ; }
 1026+# else
 1027+# { print CSV ",,,,,,,,,,,,,,,,,,,,,,," . "$language_name," ; }
9681028
969 - $m0 = &months_since_2000_01 (2010,5) ;
970 - $recent_month_0 = $totals {"month"} {$project} {"$language,${recent_months [$m0]}"} ;
971 - for ($m = $m0 ; $m < $months_recent ; $m++)
972 - {
973 - if ($recent_month_0 > 0)
974 - {
975 - print CSV sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"} / $recent_month_0) . "," ;
976 - print sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"} / $recent_month_0) . "," ;
977 - }
978 - else
979 - {
980 - print CSV "," ;
981 - print "," ;
982 - }
983 - }
 1029+# $m0 = &months_since_2000_01 (2010,5) ;
 1030+# $recent_month_0 = $totals {"month"} {$project} {"$language,${recent_months [$m0]}"} ;
 1031+# for ($m = $m0 ; $m < $months_recent ; $m++)
 1032+# {
 1033+# if ($recent_month_0 > 0)
 1034+# {
 1035+# print CSV sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"} / $recent_month_0) . "," ;
 1036+# print sprintf ("%.2f", 100 * $totals {"month"} {$project} {"$language\.m,${recent_months [$m]}"} / $recent_month_0) . "," ;
 1037+# }
 1038+# else
 1039+# {
 1040+# print CSV "," ;
 1041+# print "," ;
 1042+# }
 1043+# }
9841044
985 - if (($project ne "wp") && ($project ne "wx"))
986 - { print CSV "$language_name " . &GetProjectName ($project) . "\n" ; }
987 - else
988 - { print CSV "$language_name\n" ; }
 1045+# if (($project ne "wp") && ($project ne "wx"))
 1046+# { print CSV "$language_name " . &GetProjectName ($project) . "\n" ; }
 1047+# else
 1048+# { print CSV "$language_name\n" ; }
9891049
990 - print "\n" ;
991 - }
 1050+# print "\n" ;
 1051+# }
9921052
9931053 print CSV "\n=== Page view totals per project - non-mobile + mobile ===\n" ;
9941054 print "\n=== Page view totals per project - non-mobile + mobile ===\n" ;
9951055
996 - print CSV "\n",,,,,,,,"$csv_recent_months" ;
 1056+ print CSV "\n,,,,,,,,$csv_recent_months" ;
9971057 print "\n$csv_recent_months" ;
9981058
9991059 # write per project recent months of page view totals
10001060 $lines = 0 ;
1001 - foreach $project3 (sort { $totals_project_max {"month"} {$b} <=> $totals_project_max {"month"} {$a}} keys %projects3)
 1061+ foreach $project3 (sort { $totals_project_month_combined_max {$b} <=> $totals_project_month_combined_max {$a}} keys %projects3)
10021062 {
10031063 print CSV ",,,,,,,," . &GetProjectName2 ($project3) . "," ;
10041064 print &GetProjectName2 ($project3) . "," ;
10051065
10061066 for ($m = 0 ; $m < $months_recent ; $m++)
10071067 {
1008 - print CSV $totals_project {"month"} {$project3} {"${recent_months [$m]}"} . "," ;
1009 - print $totals_project {"month"} {$project3} {"${recent_months [$m]}"} . "," ;
 1068+ print CSV $totals_project_month_combined {$project3} {"${recent_months [$m]}"} . "," ;
 1069+ print $totals_project_month_combined {$project3} {"${recent_months [$m]}"} . "," ;
10101070 }
10111071 print CSV &GetProjectName2 ($project3) . "\n" ;
10121072 print &GetProjectName2 ($project3) . "\n" ;
10131073 }
10141074
1015 - print CSV "\n=== Page view totals per project indexed - non-mobile + mobile ===\n" ;
1016 - print "\n=== Page view totals per project indexed - non-mobile + mobile ===\n" ;
 1075+# print CSV "\n=== Page view totals per project indexed - non-mobile + mobile ===\n" ;
 1076+# print "\n=== Page view totals per project indexed - non-mobile + mobile ===\n" ;
10171077
1018 - print CSV "\n",,,,,,,,"$csv_recent_months" ;
1019 - print "\n$csv_recent_months" ;
 1078+# print CSV "\n",,,,,,,,"$csv_recent_months" ;
 1079+# print "\n$csv_recent_months" ;
10201080
1021 - # write per project recent months of page view totals
1022 - $lines = 0 ;
 1081+# # write per project recent months of page view totals
 1082+# $lines = 0 ;
10231083
1024 - foreach $project3 (sort { $totals_project_max {"month"} {$b} <=> $totals_project_max {"month"} {$a}} keys %projects3)
1025 - {
1026 - print CSV ",,,,,,,," . &GetProjectName2 ($project3) . "," ;
1027 - print &GetProjectName2 ($project3) . "," ;
 1084+# foreach $project3 (sort { $totals_project_month_combined_max {$b} <=> $totals_project_month_combined_max {$a}} keys %projects3)
 1085+# {
 1086+# print CSV ",,,,,,,," . &GetProjectName2 ($project3) . "," ;
 1087+# print &GetProjectName2 ($project3) . "," ;
10281088
1029 - $recent_month_0 = $totals_project {"month"} {$project3} {$recent_months [0]} ;
 1089+# $recent_month_0 = $totals_project_month_combined {$project3} {$recent_months [0]} ;
10301090
1031 - for ($m = 0 ; $m < $months_recent ; $m++)
1032 - {
1033 - if ($recent_month_0 > 0)
1034 - {
1035 - print CSV sprintf ("%.2f", 100 * $totals_project {"month"} {$project3} {$recent_months [$m]} / $recent_month_0) . "," ;
1036 - print sprintf ("%.2f", 100 * $totals_project {"month"} {$project3} {$recent_months [$m]} / $recent_month_0) . "," ;
1037 - }
1038 - else
1039 - {
1040 - print CSV "," ;
1041 - print "," ;
1042 - }
1043 - }
 1091+# for ($m = 0 ; $m < $months_recent ; $m++)
 1092+# {
 1093+# if ($recent_month_0 > 0)
 1094+# {
 1095+# print CSV sprintf ("%.2f", 100 * $totals_project_month_combined {$project3} {$recent_months [$m]} / $recent_month_0) . "," ;
 1096+# print sprintf ("%.2f", 100 * $totals_project_month_combined {$project3} {$recent_months [$m]} / $recent_month_0) . "," ;
 1097+# }
 1098+# else
 1099+# {
 1100+# print CSV "," ;
 1101+# print "," ;
 1102+# }
 1103+# }
10441104
1045 - print CSV &GetProjectName2 ($project3) . "," ;
1046 - print &GetProjectName2 ($project3) . "," ;
1047 - }
 1105+# print CSV &GetProjectName2 ($project3) . "," ;
 1106+# print &GetProjectName2 ($project3) . "," ;
 1107+# }
10481108
1049 - print CSV &GetProjectName2 ($project3) . "\n" ;
1050 - print &GetProjectName2 ($project3) . "\n" ;
 1109+# print CSV &GetProjectName2 ($project3) . "\n" ;
 1110+# print &GetProjectName2 ($project3) . "\n" ;
10511111
10521112 close CSV ;
10531113
Index: trunk/wikistats/dumps/WikiReportsOutputMisc.pm
@@ -455,18 +455,22 @@
456456
457457 $code_website = "<a href='${out_urls {$wpc}}'>$wpc3</a>" ;
458458
459 -
460459 if ($sitemap_new_layout)
461460 {
462461 # $out_html .= &tr (&tdimg ("<a href='TablesWikipedia" . uc($wpc) . ".htm'><img src='../Tables.png'></a> " .
463462 # $out_language_article = "<a href='" . $out_article {$wpc} . "'><b><font size=+1 color='#0000A0' face=\'Times'>W</font></b></a>" ;
464463 # $out_language_article = "[<a href='" . $out_article {$wpc} . "'>?</a>]" ;
465464 $out_language_article = "<a href='" . $out_article {$wpc} . "'>?</a> |" ;
 465+
 466+ $dir_all_languages = '' ;
 467+ if ($region ne '')
 468+ { $dir_all_languages = '../EN/' ; }
 469+
466470 $out_html .= &tr (
467471 # &tdcb ($out_language_article .
468472 # "<a href='ChartsWikipedia" . uc($wpc) . ".htm'><img src='../BarCharts.png'></a>") .
469 - &tdcb (&w("<a href='TablesWikipedia" . uc($wpc) . ".htm'> " . $out_btn_tables . " </a>")) .
470 - &tdcb (&w("<a href='ChartsWikipedia" . uc($wpc) . ".htm'> " . $out_btn_charts . " </a>")) .
 473+ &tdcb (&w("<a href='${dir_all_languages}TablesWikipedia" . uc($wpc) . ".htm'> " . $out_btn_tables . " </a>")) .
 474+ &tdcb (&w("<a href='${dir_all_languages}ChartsWikipedia" . uc($wpc) . ".htm'> " . $out_btn_charts . " </a>")) .
471475 # &tdcb ("<a href='ChartsWikipedia" . uc($wpc) . ".htm'><img src='../BarCharts.png'></a>") .
472476 (($wikimedia && (!$mode_wx)) ? &tdcb ($code_website) : &tdlb ($code_website)) .
473477 # (((! $mode_wx) && (! $singlewiki)) ? ($wikimedia ? &tdlb ($out_language_name . ' ' . $out_language_article) : "") : "") .
@@ -511,7 +515,7 @@
512516 { $out_html .= "<h2>" . $out_btn_charts . "</h2>\n" ; }
513517 }
514518
515 - $out_html .= "<a id='see_also' name='see_also'><table class='l' border=1 cellspacing=0 id=table3 style='' summary=''>\n" ;
 519+ $out_html .= "<a id='see_also' name='see_also'></a><table class='l' border=1 cellspacing=0 id=table3 style='' summary=''>\n" ;
516520
517521 if ((! $mode_wx) && (! $singlewiki))
518522 {
@@ -1102,7 +1106,7 @@
11031107
11041108 sub GenerateHtmlStartComparisonTables
11051109 {
1106 - &LogT ("GenerateHtmlStartComparisonTables\n") ;
 1110+ &LogT ("\nGenerateHtmlStartComparisonTables\n") ;
11071111
11081112 if ($pageviews)
11091113 {
@@ -1138,12 +1142,15 @@
11391143 if ($region ne "")
11401144 { $out_html_title .= " for <font color=#008000>" . ucfirst ($region) . "</font>"; }
11411145
1142 - if ($pageviews_non_mobile)
1143 - { $out_html_title .= "<font color=#008000>, Non-mobile</font>" ; }
1144 - elsif ($pageviews_mobile)
1145 - { $out_html_title .= "<font color=#008000>, Mobile</font>" ; }
1146 - elsif ($pageviews_combined)
1147 - { $out_html_title .= "<font color=#008000>, All Platforms</font>" ; }
 1146+ if ($mode_wp)
 1147+ {
 1148+ if ($pageviews_non_mobile)
 1149+ { $out_html_title .= "<font color=#008000>, Non-mobile</font>" ; }
 1150+ elsif ($pageviews_mobile)
 1151+ { $out_html_title .= "<font color=#008000>, Mobile</font>" ; }
 1152+ elsif ($pageviews_combined)
 1153+ { $out_html_title .= "<font color=#008000>, All Platforms</font>" ; }
 1154+ }
11481155
11491156 if ($normalized)
11501157 { $out_html_title .= "<font color=#008000>, Normalized</font>" ; }
Index: trunk/wikistats/dumps/WikiReportsInput.pm
@@ -36,7 +36,21 @@
3737 $normalize_days_per_month = $options {"n"} ;
3838 $dump_gallery = $options {"G"} ;
3939
40 -# Indian languages
 40+ if ($mode eq "")
 41+ { $mode = "wp" ; }
 42+ if ($mode !~ /^(?:wb|wk|wn|wp|wq|ws|wv|wx)$/)
 43+ { abort ("Specify mode as: -m [wb|wk|wn|wp|wq|ws|wv|wx]\n(wp=wikipedia (default), wb=wikibooks, wk=wiktionary, wn=wikinews, wq=wikiquote, ws=wikisource, wv=wikiversity, wx=wikispecial)") ; }
 44+
 45+ if ($mode eq "wb") { $mode_wb = $true ; }
 46+ if ($mode eq "wk") { $mode_wk = $true ; }
 47+ if ($mode eq "wn") { $mode_wn = $true ; }
 48+ if ($mode eq "wp") { $mode_wp = $true ; }
 49+ if ($mode eq "wq") { $mode_wq = $true ; }
 50+ if ($mode eq "ws") { $mode_ws = $true ; }
 51+ if ($mode eq "wv") { $mode_wv = $true ; }
 52+ if ($mode eq "wx") { $mode_wx = $true ; }
 53+
 54+ # Indian languages
4155 # as Assamese (http://as.wikipedia.org)
4256 # bn Bengali (http://bn.wikipedia.org)
4357 # bh Bhojpuri (http://bh.wikipedia.org)
@@ -174,7 +188,7 @@
175189 $keys_html_pageviews_all_projects = 'combined,' ;
176190 print "Generate page views report for mobile + non-mobile site" ;
177191 }
178 - else { abort ("Invalid option for pageviews: specify '-v n' for non-mobile or '-v m' for mobile data") ; }
 192+ else { abort ("Invalid option for pageviews: specify '-v n' for non-mobile or '-v m' for mobile data or '-v c' for combination") ; }
179193
180194 $pageviews = $true ;
181195
@@ -186,23 +200,13 @@
187201 print "\nCollect pageviews for $keys_html_pageviews_all_projects\n\n" ;
188202 }
189203
 204+ if ($pageviews && (! $pageviews_non_mobile) && (! $mode_wp))
 205+ { abort ("For all projects expect Wikipedia only render page views reports for 'non-mobile' aka 'normal'") ; }
 206+
190207 if (defined $animation)
191208 { undef $pageviews ; undef $categorytrees ; }
192209
193 - if ($mode eq "")
194 - { $mode = "wp" ; }
195 - if ($mode !~ /^(?:wb|wk|wn|wp|wq|ws|wv|wx)$/)
196 - { abort ("Specify mode as: -m [wb|wk|wn|wp|wq|ws|wv|wx]\n(wp=wikipedia (default), wb=wikibooks, wk=wiktionary, wn=wikinews, wq=wikiquote, ws=wikisource, wv=wikiversity, wx=wikispecial)") ; }
197210
198 - if ($mode eq "wb") { $mode_wb = $true ; }
199 - if ($mode eq "wk") { $mode_wk = $true ; }
200 - if ($mode eq "wn") { $mode_wn = $true ; }
201 - if ($mode eq "wp") { $mode_wp = $true ; }
202 - if ($mode eq "wq") { $mode_wq = $true ; }
203 - if ($mode eq "ws") { $mode_ws = $true ; }
204 - if ($mode eq "wv") { $mode_wv = $true ; }
205 - if ($mode eq "wx") { $mode_wx = $true ; }
206 -
207211 # if (! ($dumpdate =~ m/^\d{8,8}$/))
208212 # { abort ("Specify SQL dump date as: -d yyyymmdd\n") ; }
209213 # $filedate = timegm (0,0,0,substr($dumpdate,6,2),

Status & tagging log