From 91ad0c21426361dc0cb55736198647d3ddaff9b8 Mon Sep 17 00:00:00 2001 From: Erkan Date: Sun, 31 Mar 2013 19:47:47 +0300 Subject: [PATCH] rewrite mediawiki plugin with api access --- plugins/wiki/mediawiki_api | 143 +++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 plugins/wiki/mediawiki_api diff --git a/plugins/wiki/mediawiki_api b/plugins/wiki/mediawiki_api new file mode 100644 index 00000000..50616155 --- /dev/null +++ b/plugins/wiki/mediawiki_api @@ -0,0 +1,143 @@ +#!/usr/bin/php + +1) + $param = $argv[1]; + +switch ($param) { +case "config": + +print <<, where type can be one of: views, edits, articles, pages, users, images or admins.\n +ERROR; +} + +} + + +$s = file_get_contents($server."/api.php?action=query&meta=siteinfo&siprop=statistics&format=json"); +$json = json_decode($s); +$value = $json->{'query'}->{'statistics'}->{$suffix}; + +switch ($suffix) { + +case "views": +print "views.value $value\n"; +break; + +case "edits": +print "edits.value $value\n"; +break; + +case "articles": +print "articles.value $value\n"; +break; + +case "pages": +print "pages.value $value\n"; +break; + +case "users": +print "users.value $value\n"; +break; + +case "images": +print "images.value $value\n"; +break; + +case "admins": +print "admins.value $admins\n"; + +default: +print "link me as mediawiki_, where type can be one of: views, edits, articles, pages, users, images or admins. \n"; +} + +?>