Dzahn has uploaded a new change for review.
https://gerrit.wikimedia.org/r/55837
Change subject: fix sorting in wikimedias_html, add wikivoyage, and other minor
fixes
......................................................................
fix sorting in wikimedias_html, add wikivoyage, and other minor fixes
Change-Id: Ibf270e7f038b448ef481c74dfc9816d386ff1ae8
---
M etc/wikistats/config.php
M usr/share/php/wikistats/sortswitch.php
M var/www/wikistats/display.php
M var/www/wikistats/wikimedias_html.php
4 files changed, 77 insertions(+), 59 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/debs/wikistats
refs/changes/37/55837/1
diff --git a/etc/wikistats/config.php b/etc/wikistats/config.php
index 2654c0b..569bfbe 100644
--- a/etc/wikistats/config.php
+++ b/etc/wikistats/config.php
@@ -38,7 +38,7 @@
$dbpass="<not included>";
# current stable/dev mediawiki versions (update regularly)
-$goodversions=array('1.21wmf12','1.20wmf12','1.20wmf3','1.20wmf2','1.18wmf1','1.19wmf1','1.20wmf1','1.18.6');
+$goodversions=array('1.21wmf12','1.21wmf11','1.20wmf12','1.20wmf3','1.20wmf2','1.18wmf1','1.19wmf1','1.20wmf1','1.18.0','1.18.2');
$devversions=array('1.18alpha','1.19alpha','1.20alpha','1.21wmf1');
# maxlag parameter for API calls
diff --git a/usr/share/php/wikistats/sortswitch.php
b/usr/share/php/wikistats/sortswitch.php
index 1485f26..6227177 100644
--- a/usr/share/php/wikistats/sortswitch.php
+++ b/usr/share/php/wikistats/sortswitch.php
@@ -2,7 +2,7 @@
# allowable values for s= (order by)
if (isset($_GET['s'])) {
- $sort=mysql_escape_string($_GET['s']);
+ $sort=htmlspecialchars(mysql_escape_string($_GET['s']));
switch ($sort) {
case "name_asc":
@@ -60,7 +60,7 @@
$msort = "si_rights desc";
break;
case "version_asc":
- $msort = "si_generator desc,substring(version,3,2) asc";
+ $msort = "si_generator asc,substring(version,3,2) asc";
break;
case "version_desc":
$msort = "si_generator desc,substring(version,3,2) desc";
diff --git a/var/www/wikistats/display.php b/var/www/wikistats/display.php
index 7f5d648..56bbd1b 100644
--- a/var/www/wikistats/display.php
+++ b/var/www/wikistats/display.php
@@ -73,6 +73,11 @@
$domain="wikiversity.org";
$db_table="wikiversity";
break;
+ case "wy":
+ $project_name="Wikivoyages";
+ $domain="wikivoyage.org";
+ $db_table="wikivoyage";
+ break;
case "wx":
$project_name="Wikimedia Special Projects";
$domain="wikimedia.org";
@@ -203,7 +208,7 @@
if (isset($_GET['p']) && is_numeric($_GET['p']) && $_GET['p'] > 1 &&
$_GET['p'] < 100) {
$page=$_GET['p'];
- $page=mysql_escape_string($page);
+ $page=htmlspecialchars(mysql_escape_string($page));
$offset=($page-1)*$page_size;
} else {
$page="1";
diff --git a/var/www/wikistats/wikimedias_html.php
b/var/www/wikistats/wikimedias_html.php
index 970cde8..e5ab9c1 100644
--- a/var/www/wikistats/wikimedias_html.php
+++ b/var/www/wikistats/wikimedias_html.php
@@ -18,6 +18,9 @@
$threshold=htmlspecialchars(mysql_real_escape_string($threshold));
} else {
$threshold=0;
+ $color['back']="cccccc";
+ $color['table']="eeeeee";
+ $color['text']="000000";
}
if (isset($_GET['lines']) && is_numeric($_GET['lines']) && $_GET['lines'] > 0
&& $_GET['lines'] < 10001) {
@@ -45,6 +48,8 @@
UNION ALL
SELECT count(id) AS count,'Wikiversity' AS type FROM wikiversity
UNION ALL
+SELECT count(id) AS count,'Wikivoyage' AS type FROM wikivoyage
+UNION ALL
SELECT count(id) AS count,'Wmspecial' AS type FROM wmspecials";
$result = mysql_query("$countquery") or die(mysql_error());
@@ -55,18 +60,19 @@
# echo "$type:".$wcount[$type]." ";
}
-$wcount['Total'] = $wcount['Wikipedia'] + $wcount['Wiktionary'] +
$wcount['Wikibooks'] + $wcount['Wikinews'] + $wcount['Wikiquote'] +
$wcount['Wikisource'] + $wcount['Wmspecial'] + $wcount['Wikiversity'];
+$wcount['Total'] = $wcount['Wikipedia'] + $wcount['Wiktionary'] +
$wcount['Wikibooks'] + $wcount['Wikinews'] + $wcount['Wikiquote'] +
$wcount['Wikisource'] + $wcount['Wmspecial'] + $wcount['Wikiversity'] +
$wcount['Wikivoyage'];
$query = <<<FNORD
-(SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikipedia'
AS type,good/total AS ratio,method FROM wikipedias where prefix is not null
and good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikisource'
AS type,good/total AS ratio,method FROM wikisources where good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wiktionary'
AS type,good/total AS ratio,method FROM wiktionaries where good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikiquote'
AS type,good/total AS ratio,method FROM wikiquotes where good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikiversity'
AS type,good/total AS ratio,method FROM wikiversity where good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikibooks'
AS type,good/total AS ratio,method FROM wikibooks where good >= $threshold)
- UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'wikinews'
AS type,good/total AS ratio,method FROM wikinews where good >= $threshold)
- UNION ALL (SELECT
url,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,ts,'special'
AS type,good/total AS ratio,method FROM wmspecials where good >= $threshold)
- ORDER BY $msort LIMIT $limit;
+(SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikipedia'
AS type,good/total AS ratio,method FROM wikipedias where prefix is not null
and good >= ${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikisource'
AS type,good/total AS ratio,method FROM wikisources where good >=
${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wiktionary'
AS type,good/total AS ratio,method FROM wiktionaries where good >=
${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikiquote'
AS type,good/total AS ratio,method FROM wikiquotes where good >= ${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikiversity'
AS type,good/total AS ratio,method FROM wikiversity where good >= ${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikibooks'
AS type,good/total AS ratio,method FROM wikibooks where good >= ${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikinews'
AS type,good/total AS ratio,method FROM wikinews where good >= ${threshold})
+ UNION ALL (SELECT
prefix,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'wikivoyage'
AS type,good/total AS ratio,method FROM wikivoyage where good >= ${threshold})
+ UNION ALL (SELECT
url,good,lang,loclang,loclanglink,total,edits,admins,users,images,si_generator,version,ts,'special'
AS type,good/total AS ratio,method FROM wmspecials where good >= ${threshold})
+ ORDER BY ${msort} LIMIT ${limit};
FNORD;
# echo "query: '$query'.<br /><br />";
@@ -88,75 +94,75 @@
<div id="main" style="float:left;width:80%;">
<table>
<tr><th class="head" colspan="11">${listname}
-<div style="font-size: 60%">threshold: good ≥ ${threshold}
-<a
href="${self}?sort=${sort}&th=1000000&lines=${wcount['Total']}">1.000.000</a>
-<a
href="${self}?sort=${sort}&th=100000&lines=${wcount['Total']}">100.000</a>
-<a
href="${self}?sort=${sort}&th=10000&lines=${wcount['Total']}">10.000</a>
-<a
href="${self}?sort=${sort}&th=1000&lines=${wcount['Total']}">1.000</a>
-<a href="${self}?sort=${sort}&th=100&lines=${wcount['Total']}">100</a>
-<a href="${self}?sort=${sort}&th=0&lines=${wcount['Total']}">0</a>
-| lines: $limit : <a href="${self}?sort=${sort}&th=0&lines=10">10</a>
-<a href="${self}?sort=${sort}&th=0&lines=50">50</a>
-<a href="${self}?sort=${sort}&th=0&lines=100">100</a>
-<a href="${self}?sort=${sort}&th=0&lines=250">250</a>
-<a href="${self}?sort=${sort}&th=0&lines=500">500</a>
-<a
href="${self}?sort=${sort}&th=0&lines=${wcount['Total']}">${wcount['Total']}</a>
+<div style="font-size: 60%">threshold: good ≥ ${threshold}
+<a
href="${self}?s=${sort}&th=1000000&lines=${wcount['Total']}">1.000.000</a>
+<a
href="${self}?s=${sort}&th=100000&lines=${wcount['Total']}">100.000</a>
+<a
href="${self}?s=${sort}&th=10000&lines=${wcount['Total']}">10.000</a>
+<a href="${self}?s=${sort}&th=1000&lines=${wcount['Total']}">1.000</a>
+<a href="${self}?s=${sort}&th=100&lines=${wcount['Total']}">100</a>
+<a href="${self}?s=${sort}&th=0&lines=${wcount['Total']}">0</a>
+| lines: $limit : <a href="${self}?s=${sort}&th=0&lines=10">10</a>
+<a href="${self}?s=${sort}&th=0&lines=50">50</a>
+<a href="${self}?s=${sort}&th=0&lines=100">100</a>
+<a href="${self}?s=${sort}&th=0&lines=250">250</a>
+<a href="${self}?s=${sort}&th=0&lines=500">500</a>
+<a
href="${self}?s=${sort}&th=0&lines=${wcount['Total']}">${wcount['Total']}</a>
(max)</div></th></tr>
<tr><th class="sub">№</th>
-<th class="sub">Project (<a style="text-decoration:none;"
href="${self}?sort=prefix_asc">
-<b style="font-size: 120%;">↑</b></a><a style="text-decoration:none;"
href="${self}?sort=prefix_desc">
+<th class="sub">Project (<a style="text-decoration:none;"
href="${self}?s=prefix_asc">
+<b style="font-size: 120%;">↑</b></a><a style="text-decoration:none;"
href="${self}?s=prefix_desc">
<b style="font-size: 120%;">↓</b></a>)
-/ Type (<a style="text-decoration:none;" href="${self}?sort=type_asc">
+/ Type (<a style="text-decoration:none;" href="${self}?s=type_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=type_desc">
+<a style="text-decoration:none;" href="${self}?s=type_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Language (<a style="text-decoration:none;"
href="${self}?sort=lang_asc">
-<b style="font-size: 120%;">↑</b></a><a style="text-decoration:none;"
href="${self}?sort=lang_desc">
+<th class="sub">Language (<a style="text-decoration:none;"
href="${self}?s=lang_asc">
+<b style="font-size: 120%;">↑</b></a><a style="text-decoration:none;"
href="${self}?s=lang_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
<th class="sub">Language (local) (
-<a style="text-decoration:none;" href="${self}?sort=loclang_asc">
+<a style="text-decoration:none;" href="${self}?s=loclang_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=loclang_desc">
+<a style="text-decoration:none;" href="${self}?s=loclang_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Good (<a style="text-decoration:none;"
href="${self}?sort=good_asc">
+<th class="sub">Good (<a style="text-decoration:none;"
href="${self}?s=good_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=good_desc">
+<a style="text-decoration:none;" href="${self}?s=good_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Total (<a style="text-decoration:none;"
href="${self}?sort=total_asc">
+<th class="sub">Total (<a style="text-decoration:none;"
href="${self}?s=total_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=total_desc">
+<a style="text-decoration:none;" href="${self}?s=total_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Edits (<a style="text-decoration:none;"
href="${self}?sort=edits_asc">
+<th class="sub">Edits (<a style="text-decoration:none;"
href="${self}?s=edits_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=edits_desc">
+<a style="text-decoration:none;" href="${self}?s=edits_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Admins (<a style="text-decoration:none;"
href="${self}?sort=admins_asc">
+<th class="sub">Admins (<a style="text-decoration:none;"
href="${self}?s=admins_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=admins_desc">
+<a style="text-decoration:none;" href="${self}?s=admins_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Users (<a style="text-decoration:none;"
href="${self}?sort=users_asc">
+<th class="sub">Users (<a style="text-decoration:none;"
href="${self}?s=users_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=users_desc">
+<a style="text-decoration:none;" href="${self}?s=users_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Images (<a style="text-decoration:none;"
href="${self}?sort=images_asc">
+<th class="sub">Images (<a style="text-decoration:none;"
href="${self}?s=images_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=images_desc">
+<a style="text-decoration:none;" href="${self}?s=images_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Stub Ratio (<a style="text-decoration:none;"
href="${self}?sort=ratio_asc">
+<th class="sub">Stub Ratio (<a style="text-decoration:none;"
href="${self}?s=ratio_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=ratio_desc">
+<a style="text-decoration:none;" href="${self}?s=ratio_desc">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">Version (<a style="text-decoration:none;"
href="${self}?sort=version_asc&th=${threshold}&lines=$limit">
+<th class="sub">Version (<a style="text-decoration:none;"
href="${self}?s=version_asc&th=${threshold}&lines=${limit}">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;"
href="${self}?sort=version_desc&th=${threshold}&lines=$limit">
+<a style="text-decoration:none;"
href="${self}?s=version_desc&th=${threshold}&lines=${limit}">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub">mt (<a style="text-decoration:none;"
href="${self}?sort=stype_asc&th=${threshold}&lines=$limit">
+<th class="sub">mt (<a style="text-decoration:none;"
href="${self}?s=stype_asc&th=${threshold}&lines=${limit}">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;"
href="${self}?sort=stype_desc&th=${threshold}&lines=$limit">
+<a style="text-decoration:none;"
href="${self}?s=stype_desc&th=${threshold}&lines=${limit}">
<b style="font-size: 120%;">↓</b></a>)</th>
-<th class="sub" align="right">Last checked (<a style="text-decoration:none;"
href="${self}?sort=ts_asc">
+<th class="sub" align="right">Last checked (<a style="text-decoration:none;"
href="${self}?s=ts_asc">
<b style="font-size: 120%;">↑</b></a>
-<a style="text-decoration:none;" href="${self}?sort=ts_desc"><b
style="font-size: 120%;">↓</b></a>)
+<a style="text-decoration:none;" href="${self}?s=ts_desc"><b style="font-size:
120%;">↓</b></a>)
</th></tr>
TABLE_HEAD;
@@ -210,14 +216,18 @@
case "wikiversity":
$color="#bb77ff";
break;
+ case "wikivoyage":
+ $color="#e56717";
+ break;
default:
$color="white";
}
$stype=$row['method'];
- $domain=$row['type'].".org";
- $vurl="http://".$row['prefix'].".$domain/wiki/Special:Version";
+ #$domain=$row['type'].".org";
+ #$vurl="http://".$row['prefix'].".$domain/wiki/Special:Version";
+ $vurl="http://".$row['prefix']."/wiki/Special:Version";
if ($row['type'] == "special") {
$pieces = explode(".", $row['prefix']);
@@ -239,7 +249,7 @@
<td class=\"number\"><a
href=\"http://".$row['prefix']."/wiki/Special:Imagelist\">".$row['images']."</a></td>
<td class=\"number\">".$row['ratio']."</td>
<td class=\"number " .version_color($wikiversion)."\"><a
href=\"${vurl}\">${wikiversion}</a></td>
-<td class=\"text\"><div title=\"$get_method[$stype]\">${stype}</div></td>
+<td class=\"text\"><div title=\"$get_method[$stype]\">".$stype."</div></td>
<td style=\"font-size: 80%;\" class=\"timestamp\">".$row['ts']."</td></tr>\n";
} else {
@@ -255,7 +265,7 @@
<td class=\"number\"><a
href=\"http://".$row['prefix'].".$domain/wiki/Special:Imagelist\">".$row['images']."</a></td>
<td class=\"number\">".$row['ratio']."</td>
<td class=\"number " .version_color($wikiversion)."\"><a
href=\"${vurl}\">${wikiversion}</a></td>
-<td class=\"text\"><div title=\"$get_method[$stype]\">${stype}</div></td>
+<td class=\"text\"><div title=\"$get_method[$stype]\">".$stype."</div></td>
<td style=\"font-size: 80%;\" class=\"timestamp\">".$row['ts']."</td></tr>\n";
}
$count++;
@@ -292,6 +302,9 @@
<td class="text" style="color:black;background-color:#bb77ff"></td>
<td>Wikiversity</td>
</tr><tr>
+<td class="text" style="color:black;background-color:#e56717"></td>
+<td>Wikivoyage</td>
+</tr><tr>
<td class="text" style="color:black;background-color:red"></td>
<td>Special</td>
</tr></table></div>
--
To view, visit https://gerrit.wikimedia.org/r/55837
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf270e7f038b448ef481c74dfc9816d386ff1ae8
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/wikistats
Gerrit-Branch: master
Gerrit-Owner: Dzahn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits