https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112310
Revision: 112310
Author: ezachte
Date: 2012-02-24 10:44:57 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
more use of config file (under script specific name)
Modified Paths:
--------------
trunk/wikistats/squids/SquidReportArchive.pl
Added Paths:
-----------
trunk/wikistats/squids/SquidReportArchiveConfig.pm
Modified: trunk/wikistats/squids/SquidReportArchive.pl
===================================================================
--- trunk/wikistats/squids/SquidReportArchive.pl 2012-02-24 10:19:34 UTC
(rev 112309)
+++ trunk/wikistats/squids/SquidReportArchive.pl 2012-02-24 10:44:57 UTC
(rev 112310)
@@ -1,17 +1,13 @@
#!/usr/bin/perl
- use config ;
+ use SquidReportArchiveConfig ;
use lib $liblocation ;
use EzLib ;
$trace_on_exit = $true ;
ez_lib_version (2) ;
-# set defaults mainly for tests on local machine
-# default_argv "-m 2011-07 " ;
- default_argv "-c -q 2011Q4" ;
-# default_argv "-w" ; # refresh country info from Wikipedia (population etc)
-# default_argv "-c" ;
+ default_argv ($default_argv) ;
# to do: add text from http://wiki.squid-cache.org/SquidFaq/SquidLogs
# ReportOrigin how to handle '!error <-> other
@@ -42,17 +38,18 @@
$path_in = "/a/ezachte" ;
$path_out = "/a/ezachte" ;
}
- elsif ($hostname eq 'bayes')
- {
- &Log ("\n\nJob runs on server $hostname\n\n") ;
- $path_in = "/home/ezachte/wikistats/animation" ;
- $path_out = "/home/ezachte/wikistats/animation" ;
- }
+# following test needs to change -> remove server name dependency (new run
argument ?)
+# elsif ($hostname eq 'bayes')
+# {
+# &Log ("\n\nJob runs on server $hostname\n\n") ;
+# $path_in = "/home/ezachte/wikistats/animation" ;
+# $path_out = "/home/ezachte/wikistats/animation" ;
+# }
else
{
print "Job runs local for tests\n\n" ;
- $path_in = "/srv/erik/" ;
- $path_out = "/srv/erik/" ;
+ $path_in = $path_in_local ;
+ $path_out = $path_out_local ;
}
&Log ("Path in = $path_in\n") ;
@@ -667,9 +664,9 @@
if ($mimecat eq 'page')
{
$total_clients_html_only += $count ;
- if ($rectype eq "-") { $total_clients_non_mobile_html_only += $count ;
}
- if ($rectype eq "M") { $total_clients_mobile_html_only += $count ;
}
- if ($rectype eq "W") { $total_clients_wiki_mobile_html_only +=
$count ; }
+ if ($rectype eq "-") { $total_clients_non_mobile_html_only += $count
; }
+ if ($rectype eq "M") { $total_clients_mobile_html_only += $count
; }
+ if ($rectype eq "W") { $total_clients_wiki_mobile_html_only += $count
; }
$clients_html_only {"$rectype,$client"} += $count ;
}
}
@@ -874,7 +871,7 @@
$line =~ s/^.*?: // ;
($month_upd_keywords_mobile = $line) =~ s/^.*?\(([^\)]+)\).*$/$1/ ;
($keywords_mobile = $line) =~ s/ \([^\)]+\).*$// ;
- ($keywords_wiki_mobile = $line) =~ s/ \([^\)]+\).*$// ;
+ ($keywords_wiki_mobile = $line) =~ s/ \([^\)]+\).*$// ;
$keywords_mobile =~ s/\|/, /g ;
$keywords_mobile =~ s/((?:[^,]+,){10})/$1<br>/g ;
$keywords_wiki_mobile =~ s/((?:[^,]+,){10})/$1<br>/g ;
@@ -1931,9 +1928,9 @@
$total_clients_wiki_mobile= &Normalize ($total_clients_wiki_mobile) ;
$total_clients_non_mobile = &Normalize ($total_clients_non_mobile) ;
- $total_clients_html_only = &Normalize ($total_clients_html_only) ;
- $total_clients_mobile_html_only = &Normalize
($total_clients_mobile_html_only) ;
- $total_clients_non_mobile_html_only = &Normalize
($total_clients_non_mobile_html_only) ;
+ $total_clients_html_only = &Normalize ($total_clients_html_only)
;
+ $total_clients_mobile_html_only = &Normalize
($total_clients_mobile_html_only) ;
+ $total_clients_non_mobile_html_only = &Normalize
($total_clients_non_mobile_html_only) ;
$total_clients_wiki_mobile_html_only = &Normalize
($total_clients_wiki_mobile_html_only) ;
# ReadInputCrawlers
@@ -2379,7 +2376,7 @@
$perc = ".." ;
if ($total_clientgroups {'-'} + $total_clientgroups {'M'} +
$total_clientgroups {'W'}> 0)
{ $perc = sprintf ("%.2f", 100 * $count / ($total_clientgroups {'-'} +
$total_clientgroups {'M'} + $total_clientgroups {'W'})) ; }
-
+
$count_html_only = $clientgroups_other_html_only {'-'} ;
$total_html_only = &FormatCount ($total_clientgroups_html_only {'-'}) ;
$perc_html_only = ".." ;
Added: trunk/wikistats/squids/SquidReportArchiveConfig.pm
===================================================================
--- trunk/wikistats/squids/SquidReportArchiveConfig.pm
(rev 0)
+++ trunk/wikistats/squids/SquidReportArchiveConfig.pm 2012-02-24 10:44:57 UTC
(rev 112310)
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+ $liblocation = "/home/ezachte/lib" ;
+
+# $path_in_local = "W:/# Out Locke" ; # Erik
+# $path_out_local = "W:/# Out Test/Locke" ; # Erik
+
+ $path_in = "/srv/erik/" ; # Andr\xE9
+ $path_out = "/srv/erik/" ; # Andr\xE9
+
+# set defaults for tests on local machine
+# $default_argv = "-m 2011-07" ; # monthly report
+# $default_argv = "-w" ; # refresh country info from Wikipedia
(population etc)
+# $default_argv = "-c" ; # country/regional reports
+ $default_argv = "-c -q 2011Q4" ; # country/regional reports based on data
for one quarter only
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs