r112310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112309‎ | r112310 | r112311 >
Date:10:44, 24 February 2012
Author:ezachte
Status:deferred
Tags:
Comment:
more use of config file (under script specific name)
Modified paths:
  • /trunk/wikistats/squids/SquidReportArchive.pl (modified) (history)
  • /trunk/wikistats/squids/SquidReportArchiveConfig.pm (added) (history)

Diff [purge]

Index: trunk/wikistats/squids/SquidReportArchive.pl
@@ -1,17 +1,13 @@
22 #!/usr/bin/perl
33
4 - use config ;
 4+ use SquidReportArchiveConfig ;
55 use lib $liblocation ;
66
77 use EzLib ;
88 $trace_on_exit = $true ;
99 ez_lib_version (2) ;
1010
11 -# set defaults mainly for tests on local machine
12 -# default_argv "-m 2011-07 " ;
13 - default_argv "-c -q 2011Q4" ;
14 -# default_argv "-w" ; # refresh country info from Wikipedia (population etc)
15 -# default_argv "-c" ;
 11+ default_argv ($default_argv) ;
1612
1713 # to do: add text from http://wiki.squid-cache.org/SquidFaq/SquidLogs
1814 # ReportOrigin how to handle '!error <-> other
@@ -42,17 +38,18 @@
4339 $path_in = "/a/ezachte" ;
4440 $path_out = "/a/ezachte" ;
4541 }
46 - elsif ($hostname eq 'bayes')
47 - {
48 - &Log ("\n\nJob runs on server $hostname\n\n") ;
49 - $path_in = "/home/ezachte/wikistats/animation" ;
50 - $path_out = "/home/ezachte/wikistats/animation" ;
51 - }
 42+# following test needs to change -> remove server name dependency (new run argument ?)
 43+# elsif ($hostname eq 'bayes')
 44+# {
 45+# &Log ("\n\nJob runs on server $hostname\n\n") ;
 46+# $path_in = "/home/ezachte/wikistats/animation" ;
 47+# $path_out = "/home/ezachte/wikistats/animation" ;
 48+# }
5249 else
5350 {
5451 print "Job runs local for tests\n\n" ;
55 - $path_in = "/srv/erik/" ;
56 - $path_out = "/srv/erik/" ;
 52+ $path_in = $path_in_local ;
 53+ $path_out = $path_out_local ;
5754 }
5855
5956 &Log ("Path in = $path_in\n") ;
@@ -667,9 +664,9 @@
668665 if ($mimecat eq 'page')
669666 {
670667 $total_clients_html_only += $count ;
671 - if ($rectype eq "-") { $total_clients_non_mobile_html_only += $count ; }
672 - if ($rectype eq "M") { $total_clients_mobile_html_only += $count ; }
673 - if ($rectype eq "W") { $total_clients_wiki_mobile_html_only += $count ; }
 668+ if ($rectype eq "-") { $total_clients_non_mobile_html_only += $count ; }
 669+ if ($rectype eq "M") { $total_clients_mobile_html_only += $count ; }
 670+ if ($rectype eq "W") { $total_clients_wiki_mobile_html_only += $count ; }
674671 $clients_html_only {"$rectype,$client"} += $count ;
675672 }
676673 }
@@ -874,7 +871,7 @@
875872 $line =~ s/^.*?: // ;
876873 ($month_upd_keywords_mobile = $line) =~ s/^.*?\(([^\)]+)\).*$/$1/ ;
877874 ($keywords_mobile = $line) =~ s/ \([^\)]+\).*$// ;
878 - ($keywords_wiki_mobile = $line) =~ s/ \([^\)]+\).*$// ;
 875+ ($keywords_wiki_mobile = $line) =~ s/ \([^\)]+\).*$// ;
879876 $keywords_mobile =~ s/\|/, /g ;
880877 $keywords_mobile =~ s/((?:[^,]+,){10})/$1<br>/g ;
881878 $keywords_wiki_mobile =~ s/((?:[^,]+,){10})/$1<br>/g ;
@@ -1931,9 +1928,9 @@
19321929 $total_clients_wiki_mobile= &Normalize ($total_clients_wiki_mobile) ;
19331930 $total_clients_non_mobile = &Normalize ($total_clients_non_mobile) ;
19341931
1935 - $total_clients_html_only = &Normalize ($total_clients_html_only) ;
1936 - $total_clients_mobile_html_only = &Normalize ($total_clients_mobile_html_only) ;
1937 - $total_clients_non_mobile_html_only = &Normalize ($total_clients_non_mobile_html_only) ;
 1932+ $total_clients_html_only = &Normalize ($total_clients_html_only) ;
 1933+ $total_clients_mobile_html_only = &Normalize ($total_clients_mobile_html_only) ;
 1934+ $total_clients_non_mobile_html_only = &Normalize ($total_clients_non_mobile_html_only) ;
19381935 $total_clients_wiki_mobile_html_only = &Normalize ($total_clients_wiki_mobile_html_only) ;
19391936
19401937 # ReadInputCrawlers
@@ -2379,7 +2376,7 @@
23802377 $perc = ".." ;
23812378 if ($total_clientgroups {'-'} + $total_clientgroups {'M'} + $total_clientgroups {'W'}> 0)
23822379 { $perc = sprintf ("%.2f", 100 * $count / ($total_clientgroups {'-'} + $total_clientgroups {'M'} + $total_clientgroups {'W'})) ; }
2383 -
 2380+
23842381 $count_html_only = $clientgroups_other_html_only {'-'} ;
23852382 $total_html_only = &FormatCount ($total_clientgroups_html_only {'-'}) ;
23862383 $perc_html_only = ".." ;
Index: trunk/wikistats/squids/SquidReportArchiveConfig.pm
@@ -0,0 +1,15 @@
 2+#!/usr/bin/perl
 3+
 4+ $liblocation = "/home/ezachte/lib" ;
 5+
 6+# $path_in_local = "W:/# Out Locke" ; # Erik
 7+# $path_out_local = "W:/# Out Test/Locke" ; # Erik
 8+
 9+ $path_in = "/srv/erik/" ; # Andr�
 10+ $path_out = "/srv/erik/" ; # Andr�
 11+
 12+# set defaults for tests on local machine
 13+# $default_argv = "-m 2011-07" ; # monthly report
 14+# $default_argv = "-w" ; # refresh country info from Wikipedia (population etc)
 15+# $default_argv = "-c" ; # country/regional reports
 16+ $default_argv = "-c -q 2011Q4" ; # country/regional reports based on data for one quarter only

Status & tagging log