Dzahn has submitted this change and it was merged.

Change subject: add table for miraheze and bump version
......................................................................


add table for miraheze and bump version

Bug:T107398
Change-Id: I0304f16ed5f3dbb6b752616ab88e2c09671c166d
---
M debian/changelog
M etc/wikistats/config.php
M usr/lib/wikistats/update.php
M usr/lib/wikistats/update_functions.php
M usr/share/php/wikistats/coalesced_query.php
M usr/share/php/wikistats/largest_query.php
M var/www/wikistats/detail.php
M var/www/wikistats/display.php
M var/www/wikistats/displayw.php
M var/www/wikistats/largest_html.php
10 files changed, 47 insertions(+), 2 deletions(-)

Approvals:
  Dzahn: Looks good to me, approved



diff --git a/debian/changelog b/debian/changelog
index 761355a..2d707ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+wikistats (2.11) unstable; urgency=low
+
+  * add table for miraheze (T107398)
+
+ -- Daniel Zahn <[email protected]>  Thu, 13 Aug 2015 16:21:23 -0800
+
 wikistats (2.10) unstable; urgency=low
 
   * remove wikki and gentoo tables because they are down entirely
diff --git a/etc/wikistats/config.php b/etc/wikistats/config.php
index b4ad246..e56b2ee 100644
--- a/etc/wikistats/config.php
+++ b/etc/wikistats/config.php
@@ -60,10 +60,10 @@
 $socket_timeout="10";
 
 # list all tables (which should be displayed on index page and included in 
grand totals)
-$listtables=array('wikipedias','wikiquotes','wikibooks','wiktionaries','wikinews','wikisources','wikia','editthis','wikitravel','mediawikis','uncyclomedia','anarchopedias','opensuse','richdex','gratiswiki','qweki','wikisite','hyperwave','scoutwiki','wmspecials','qweki','wikiversity','wikifur','metapedias','neoseeker','shoutwiki','referata','pardus','rodovid','lxde','wikivoyage','w3cwikis',
 'gamepedias', 'sourceforge', 'orain');
+$listtables=array('wikipedias','wikiquotes','wikibooks','wiktionaries','wikinews','wikisources','wikia','editthis','wikitravel','mediawikis','uncyclomedia','anarchopedias','opensuse','richdex','gratiswiki','qweki','wikisite','hyperwave','scoutwiki','wmspecials','qweki','wikiversity','wikifur','metapedias','neoseeker','shoutwiki','referata','pardus','rodovid','lxde','wikivoyage','w3cwikis',
 'gamepedias', 'sourceforge', 'orain', 'miraheze');
 
 # list tables which are valid for our api.php - CHECKME
-$valid_api_tables=array('wikipedias','mediawikis','wiktionaries','wikia','wikisources','wmspecials','uncyclomedia','wikibooks','wikiquotes','editthis','wikinews','wikisite','wikitravel','scoutwiki','anarchopedias','opensuse','gratiswiki','wikimedias','metapedias','wikifur','neoseeker','wikiversity','wikivoyage','w3cwikis','gamepedias',
 'sourceforge', 'orain');
+$valid_api_tables=array('wikipedias','mediawikis','wiktionaries','wikia','wikisources','wmspecials','uncyclomedia','wikibooks','wikiquotes','editthis','wikinews','wikisite','wikitravel','scoutwiki','anarchopedias','opensuse','gratiswiki','wikimedias','metapedias','wikifur','neoseeker','wikiversity','wikivoyage','w3cwikis','gamepedias',
 'sourceforge', 'orain', 'miraheze');
 
 # list tables which should have language columns in the html tables
 
$tables_with_language_columns=array('wikipedias','wiktionaries','wikisources','uncyclomedia','wikibooks','wikiquotes','wikinews','wikitravel','anarchopedias','wikimedias','wikifur','wikiversity','pardus','rodovid','lxde','wikivoyage','metapedias');
@@ -74,6 +74,9 @@
 # list tables with URLs like wikiname.domain.org/wiki/api.php
 $tables_with_prefix_wiki=array('sourceforge');
 
+# list tables with URLs like wikiname.domain.org/w/api.php
+$tables_with_prefix_w=array('miraheze');
+
 # list tables with URLs like domain.org/wikiname/api.php
 $tables_with_suffix_short=array('editthis','lxde');
 
diff --git a/usr/lib/wikistats/update.php b/usr/lib/wikistats/update.php
index 4a7911b..a242840 100644
--- a/usr/lib/wikistats/update.php
+++ b/usr/lib/wikistats/update.php
@@ -180,6 +180,10 @@
         $table="wikia";
         $domain="wikia.com";
     break;
+    case "mh":
+        $table="miraheze";
+        $domain="miraheze.org";
+    break;
     default:
         $table="unknown";
         print "unknown table. exiting\n";
@@ -316,6 +320,13 @@
             } else {
                 
$url="http://".$row['prefix'].".${domain}/wiki/api.php${api_query_stat}";
             }
+        } elseif (in_array($table, $tables_with_prefix_w)) {
+            $prefix=$row['prefix'];
+            if ($row['statsurl']!='') {
+                $url=$row['statsurl'];
+            } else {
+                
$url="http://".$row['prefix'].".${domain}/w/api.php${api_query_stat}";
+            }
         } elseif (in_array($table, $tables_with_suffix_short)) {
             $prefix=$row['prefix'];
             
$url="http://${domain}/".$row['prefix']."/api.php${api_query_stat}";
diff --git a/usr/lib/wikistats/update_functions.php 
b/usr/lib/wikistats/update_functions.php
index b5cf18b..467df7b 100755
--- a/usr/lib/wikistats/update_functions.php
+++ b/usr/lib/wikistats/update_functions.php
@@ -148,6 +148,10 @@
         $table="orain";
         $domain="orain.org";
     break;
+    case "mh":
+        $table="miraheze";
+        $domain="miraheze.org";
+    break;
     default:
         $table="unknown";
         print "unknown table. exiting\n";
diff --git a/usr/share/php/wikistats/coalesced_query.php 
b/usr/share/php/wikistats/coalesced_query.php
index 22d353c..f8199ae 100644
--- a/usr/share/php/wikistats/coalesced_query.php
+++ b/usr/share/php/wikistats/coalesced_query.php
@@ -59,6 +59,8 @@
 (select 'sf' as project,'sourceforge' as name,sum(good) as ggood, sum(total) 
as gtotal, sum(edits) as gedits, sum(admins) as gadmins, sum(users) as 
gusers,sum(images) as gimages, count(id) as numwikis from sourceforge)
 union all
 (select 'or' as project,'orain' as name,sum(good) as ggood, sum(total) as 
gtotal, sum(edits) as gedits, sum(admins) as gadmins, sum(users) as 
gusers,sum(images) as gimages, count(id) as numwikis from orain)
+union all
+(select 'mh' as project,'miraheze' as name,sum(good) as ggood, sum(total) as 
gtotal, sum(edits) as gedits, sum(admins) as gadmins, sum(users) as 
gusers,sum(images) as gimages, count(id) as numwikis from miraheze)
 order by ${sort};";
 
 ?>
diff --git a/usr/share/php/wikistats/largest_query.php 
b/usr/share/php/wikistats/largest_query.php
index c8613c0..90a3eb1 100755
--- a/usr/share/php/wikistats/largest_query.php
+++ b/usr/share/php/wikistats/largest_query.php
@@ -57,6 +57,8 @@
 
 UNION SELECT ${fields_nolangs},"Orain" AS type FROM orain WHERE good >= 
${threshold}
 
+UNION SELECT ${fields_nolangs},"Miraheze" AS type FROM miraheze WHERE good >= 
${threshold}
+
 ORDER BY ${msort} LIMIT ${limit};
 
 FNORD;
diff --git a/var/www/wikistats/detail.php b/var/www/wikistats/detail.php
index acdd62f..6b14e72 100644
--- a/var/www/wikistats/detail.php
+++ b/var/www/wikistats/detail.php
@@ -184,6 +184,11 @@
         $domain="orain.org";
         $db_table="orain";
     break;
+    case "mh":
+        $project_name="Miraheze";
+        $domain="miraheze.org";
+        $db_table="miraheze";
+    break;
 default:
 
     $project_name="invalid";
diff --git a/var/www/wikistats/display.php b/var/www/wikistats/display.php
index 9adcfba..98a7cd4 100644
--- a/var/www/wikistats/display.php
+++ b/var/www/wikistats/display.php
@@ -184,6 +184,11 @@
         $domain="orain.org";
         $db_table="orain";
     break;
+    case "mh":
+        $project_name="Miraheze";
+        $domain="miraheze.org";
+        $db_table="miraheze";
+    break;
 default:
 
     $project_name="invalid";
diff --git a/var/www/wikistats/displayw.php b/var/www/wikistats/displayw.php
index a64b79d..08c92b2 100644
--- a/var/www/wikistats/displayw.php
+++ b/var/www/wikistats/displayw.php
@@ -179,6 +179,11 @@
         $domain="orain.org";
         $db_table="orain";
     break;
+    case "mh":
+        $project_name="Miraheze";
+        $domain="miraheze.org";
+        $db_table="miraheze";
+    break;
 default:
 
     $project_name="invalid";
diff --git a/var/www/wikistats/largest_html.php 
b/var/www/wikistats/largest_html.php
index 620c4ef..5aa8405 100644
--- a/var/www/wikistats/largest_html.php
+++ b/var/www/wikistats/largest_html.php
@@ -85,6 +85,8 @@
 UNION ALL
 SELECT count(id) AS count,'Orain' AS type FROM orain
 UNION ALL
+SELECT count(id) AS count,'Miraheze' AS type FROM miraheze
+UNION ALL
 SELECT count(id) AS count,'Elwiki' AS type FROM elwiki where inactive is null";
 
 $result = mysql_query("$countquery") or die(mysql_error());

-- 
To view, visit https://gerrit.wikimedia.org/r/231459
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0304f16ed5f3dbb6b752616ab88e2c09671c166d
Gerrit-PatchSet: 2
Gerrit-Project: operations/debs/wikistats
Gerrit-Branch: master
Gerrit-Owner: Dzahn <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to