Merge "Remove unused messages 'edit-externally' and 'edit-externally-help'"
[mediawiki.git] / includes / api / ApiQuerySiteinfo.php
blob1c188da0a9756b17064f59d410809be926dd72e0
1 <?php
2 /**
5 * Created on Sep 25, 2006
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
24 * @file
27 /**
28 * A query action to return meta information about the wiki site.
30 * @ingroup API
32 class ApiQuerySiteinfo extends ApiQueryBase {
34 public function __construct( $query, $moduleName ) {
35 parent::__construct( $query, $moduleName, 'si' );
38 public function execute() {
39 $params = $this->extractRequestParams();
40 $done = array();
41 $fit = false;
42 foreach ( $params['prop'] as $p ) {
43 switch ( $p ) {
44 case 'general':
45 $fit = $this->appendGeneralInfo( $p );
46 break;
47 case 'namespaces':
48 $fit = $this->appendNamespaces( $p );
49 break;
50 case 'namespacealiases':
51 $fit = $this->appendNamespaceAliases( $p );
52 break;
53 case 'specialpagealiases':
54 $fit = $this->appendSpecialPageAliases( $p );
55 break;
56 case 'magicwords':
57 $fit = $this->appendMagicWords( $p );
58 break;
59 case 'interwikimap':
60 $filteriw = isset( $params['filteriw'] ) ? $params['filteriw'] : false;
61 $fit = $this->appendInterwikiMap( $p, $filteriw );
62 break;
63 case 'dbrepllag':
64 $fit = $this->appendDbReplLagInfo( $p, $params['showalldb'] );
65 break;
66 case 'statistics':
67 $fit = $this->appendStatistics( $p );
68 break;
69 case 'usergroups':
70 $fit = $this->appendUserGroups( $p, $params['numberingroup'] );
71 break;
72 case 'extensions':
73 $fit = $this->appendExtensions( $p );
74 break;
75 case 'fileextensions':
76 $fit = $this->appendFileExtensions( $p );
77 break;
78 case 'rightsinfo':
79 $fit = $this->appendRightsInfo( $p );
80 break;
81 case 'languages':
82 $fit = $this->appendLanguages( $p );
83 break;
84 case 'skins':
85 $fit = $this->appendSkins( $p );
86 break;
87 case 'extensiontags':
88 $fit = $this->appendExtensionTags( $p );
89 break;
90 case 'functionhooks':
91 $fit = $this->appendFunctionHooks( $p );
92 break;
93 case 'showhooks':
94 $fit = $this->appendSubscribedHooks( $p );
95 break;
96 case 'variables':
97 $fit = $this->appendVariables( $p );
98 break;
99 case 'protocols':
100 $fit = $this->appendProtocols( $p );
101 break;
102 default:
103 ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" );
105 if ( !$fit ) {
106 // Abuse siprop as a query-continue parameter
107 // and set it to all unprocessed props
108 $this->setContinueEnumParameter( 'prop', implode( '|',
109 array_diff( $params['prop'], $done ) ) );
110 break;
112 $done[] = $p;
116 protected function appendGeneralInfo( $property ) {
117 global $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion;
119 $data = array();
120 $mainPage = Title::newMainPage();
121 $data['mainpage'] = $mainPage->getPrefixedText();
122 $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT );
123 $data['sitename'] = $GLOBALS['wgSitename'];
124 $data['logo'] = $GLOBALS['wgLogo'];
125 $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
126 $data['phpversion'] = phpversion();
127 $data['phpsapi'] = PHP_SAPI;
128 $data['dbtype'] = $GLOBALS['wgDBtype'];
129 $data['dbversion'] = $this->getDB()->getServerVersion();
131 $allowFrom = array( '' );
132 $allowException = true;
133 if ( !$GLOBALS['wgAllowExternalImages'] ) {
134 if ( $GLOBALS['wgEnableImageWhitelist'] ) {
135 $data['imagewhitelistenabled'] = '';
137 $allowFrom = $GLOBALS['wgAllowExternalImagesFrom'];
138 $allowException = !empty( $allowFrom );
140 if ( $allowException ) {
141 $data['externalimages'] = (array)$allowFrom;
142 $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
145 if ( !$wgDisableLangConversion ) {
146 $data['langconversion'] = '';
149 if ( !$wgDisableTitleConversion ) {
150 $data['titleconversion'] = '';
153 if ( $wgContLang->linkPrefixExtension() ) {
154 $linkPrefixCharset = $wgContLang->linkPrefixCharset();
155 $data['linkprefixcharset'] = $linkPrefixCharset;
156 // For backwards compatability
157 $data['linkprefix'] = "/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
158 } else {
159 $data['linkprefixcharset'] = '';
160 $data['linkprefix'] = '';
163 $linktrail = $wgContLang->linkTrail();
164 if ( $linktrail ) {
165 $data['linktrail'] = $linktrail;
166 } else {
167 $data['linktrail'] = '';
170 $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] );
171 if ( $git ) {
172 $data['git-hash'] = $git;
173 } else {
174 $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
175 if ( $svn ) {
176 $data['rev'] = $svn;
180 // 'case-insensitive' option is reserved for future
181 $data['case'] = $GLOBALS['wgCapitalLinks'] ? 'first-letter' : 'case-sensitive';
183 if ( isset( $GLOBALS['wgRightsCode'] ) ) {
184 $data['rightscode'] = $GLOBALS['wgRightsCode'];
186 $data['rights'] = $GLOBALS['wgRightsText'];
187 $data['lang'] = $GLOBALS['wgLanguageCode'];
189 $fallbacks = array();
190 foreach ( $wgContLang->getFallbackLanguages() as $code ) {
191 $fallbacks[] = array( 'code' => $code );
193 $data['fallback'] = $fallbacks;
194 $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
196 if ( $wgContLang->hasVariants() ) {
197 $variants = array();
198 foreach ( $wgContLang->getVariants() as $code ) {
199 $variants[] = array( 'code' => $code );
201 $data['variants'] = $variants;
202 $this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
205 if ( $wgContLang->isRTL() ) {
206 $data['rtl'] = '';
208 $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
210 if ( wfReadOnly() ) {
211 $data['readonly'] = '';
212 $data['readonlyreason'] = wfReadOnlyReason();
214 if ( $GLOBALS['wgEnableWriteAPI'] ) {
215 $data['writeapi'] = '';
218 $tz = $GLOBALS['wgLocaltimezone'];
219 $offset = $GLOBALS['wgLocalTZoffset'];
220 if ( is_null( $tz ) ) {
221 $tz = 'UTC';
222 $offset = 0;
223 } elseif ( is_null( $offset ) ) {
224 $offset = 0;
226 $data['timezone'] = $tz;
227 $data['timeoffset'] = intval( $offset );
228 $data['articlepath'] = $GLOBALS['wgArticlePath'];
229 $data['scriptpath'] = $GLOBALS['wgScriptPath'];
230 $data['script'] = $GLOBALS['wgScript'];
231 $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
232 $data['server'] = $GLOBALS['wgServer'];
233 $data['wikiid'] = wfWikiID();
234 $data['time'] = wfTimestamp( TS_ISO_8601, time() );
236 if ( $GLOBALS['wgMiserMode'] ) {
237 $data['misermode'] = '';
240 $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
242 wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
244 return $this->getResult()->addValue( 'query', $property, $data );
247 protected function appendNamespaces( $property ) {
248 global $wgContLang;
249 $data = array();
250 foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
251 $data[$ns] = array(
252 'id' => intval( $ns ),
253 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
255 ApiResult::setContent( $data[$ns], $title );
256 $canonical = MWNamespace::getCanonicalName( $ns );
258 if ( MWNamespace::hasSubpages( $ns ) ) {
259 $data[$ns]['subpages'] = '';
262 if ( $canonical ) {
263 $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
266 if ( MWNamespace::isContent( $ns ) ) {
267 $data[$ns]['content'] = '';
270 if ( MWNamespace::isNonincludable( $ns ) ) {
271 $data[$ns]['nonincludable'] = '';
274 $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
275 if ( $contentmodel ) {
276 $data[$ns]['defaultcontentmodel'] = $contentmodel;
280 $this->getResult()->setIndexedTagName( $data, 'ns' );
282 return $this->getResult()->addValue( 'query', $property, $data );
285 protected function appendNamespaceAliases( $property ) {
286 global $wgNamespaceAliases, $wgContLang;
287 $aliases = array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() );
288 $namespaces = $wgContLang->getNamespaces();
289 $data = array();
290 foreach ( $aliases as $title => $ns ) {
291 if ( $namespaces[$ns] == $title ) {
292 // Don't list duplicates
293 continue;
295 $item = array(
296 'id' => intval( $ns )
298 ApiResult::setContent( $item, strtr( $title, '_', ' ' ) );
299 $data[] = $item;
302 sort( $data );
304 $this->getResult()->setIndexedTagName( $data, 'ns' );
306 return $this->getResult()->addValue( 'query', $property, $data );
309 protected function appendSpecialPageAliases( $property ) {
310 global $wgContLang;
311 $data = array();
312 $aliases = $wgContLang->getSpecialPageAliases();
313 foreach ( SpecialPageFactory::getList() as $specialpage => $stuff ) {
314 if ( isset( $aliases[$specialpage] ) ) {
315 $arr = array( 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] );
316 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
317 $data[] = $arr;
320 $this->getResult()->setIndexedTagName( $data, 'specialpage' );
322 return $this->getResult()->addValue( 'query', $property, $data );
325 protected function appendMagicWords( $property ) {
326 global $wgContLang;
327 $data = array();
328 foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) {
329 $caseSensitive = array_shift( $aliases );
330 $arr = array( 'name' => $magicword, 'aliases' => $aliases );
331 if ( $caseSensitive ) {
332 $arr['case-sensitive'] = '';
334 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
335 $data[] = $arr;
337 $this->getResult()->setIndexedTagName( $data, 'magicword' );
339 return $this->getResult()->addValue( 'query', $property, $data );
342 protected function appendInterwikiMap( $property, $filter ) {
343 $local = null;
344 if ( $filter === 'local' ) {
345 $local = 1;
346 } elseif ( $filter === '!local' ) {
347 $local = 0;
348 } elseif ( $filter ) {
349 ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" );
352 $params = $this->extractRequestParams();
353 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
354 $langNames = Language::fetchLanguageNames( $langCode );
356 $getPrefixes = Interwiki::getAllPrefixes( $local );
357 $data = array();
359 foreach ( $getPrefixes as $row ) {
360 $prefix = $row['iw_prefix'];
361 $val = array();
362 $val['prefix'] = $prefix;
363 if ( $row['iw_local'] == '1' ) {
364 $val['local'] = '';
366 if ( $row['iw_trans'] == '1' ) {
367 $val['trans'] = '';
369 if ( isset( $langNames[$prefix] ) ) {
370 $val['language'] = $langNames[$prefix];
372 $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
373 if ( isset( $row['iw_wikiid'] ) ) {
374 $val['wikiid'] = $row['iw_wikiid'];
376 if ( isset( $row['iw_api'] ) ) {
377 $val['api'] = $row['iw_api'];
380 $data[] = $val;
383 $this->getResult()->setIndexedTagName( $data, 'iw' );
385 return $this->getResult()->addValue( 'query', $property, $data );
388 protected function appendDbReplLagInfo( $property, $includeAll ) {
389 global $wgShowHostnames;
390 $data = array();
391 $lb = wfGetLB();
392 if ( $includeAll ) {
393 if ( !$wgShowHostnames ) {
394 $this->dieUsage(
395 'Cannot view all servers info unless $wgShowHostnames is true',
396 'includeAllDenied'
400 $lags = $lb->getLagTimes();
401 foreach ( $lags as $i => $lag ) {
402 $data[] = array(
403 'host' => $lb->getServerName( $i ),
404 'lag' => $lag
407 } else {
408 list( , $lag, $index ) = $lb->getMaxLag();
409 $data[] = array(
410 'host' => $wgShowHostnames
411 ? $lb->getServerName( $index )
412 : '',
413 'lag' => intval( $lag )
417 $result = $this->getResult();
418 $result->setIndexedTagName( $data, 'db' );
420 return $this->getResult()->addValue( 'query', $property, $data );
423 protected function appendStatistics( $property ) {
424 global $wgDisableCounters;
425 $data = array();
426 $data['pages'] = intval( SiteStats::pages() );
427 $data['articles'] = intval( SiteStats::articles() );
428 if ( !$wgDisableCounters ) {
429 $data['views'] = intval( SiteStats::views() );
431 $data['edits'] = intval( SiteStats::edits() );
432 $data['images'] = intval( SiteStats::images() );
433 $data['users'] = intval( SiteStats::users() );
434 $data['activeusers'] = intval( SiteStats::activeUsers() );
435 $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) );
436 $data['jobs'] = intval( SiteStats::jobs() );
438 wfRunHooks( 'APIQuerySiteInfoStatisticsInfo', array( &$data ) );
440 return $this->getResult()->addValue( 'query', $property, $data );
443 protected function appendUserGroups( $property, $numberInGroup ) {
444 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
445 global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
447 $data = array();
448 $result = $this->getResult();
449 foreach ( $wgGroupPermissions as $group => $permissions ) {
450 $arr = array(
451 'name' => $group,
452 'rights' => array_keys( $permissions, true ),
455 if ( $numberInGroup ) {
456 global $wgAutopromote;
458 if ( $group == 'user' ) {
459 $arr['number'] = SiteStats::users();
460 // '*' and autopromote groups have no size
461 } elseif ( $group !== '*' && !isset( $wgAutopromote[$group] ) ) {
462 $arr['number'] = SiteStats::numberInGroup( $group );
466 $groupArr = array(
467 'add' => $wgAddGroups,
468 'remove' => $wgRemoveGroups,
469 'add-self' => $wgGroupsAddToSelf,
470 'remove-self' => $wgGroupsRemoveFromSelf
473 foreach ( $groupArr as $type => $rights ) {
474 if ( isset( $rights[$group] ) ) {
475 $arr[$type] = $rights[$group];
476 $result->setIndexedTagName( $arr[$type], 'group' );
480 $result->setIndexedTagName( $arr['rights'], 'permission' );
481 $data[] = $arr;
484 $result->setIndexedTagName( $data, 'group' );
486 return $result->addValue( 'query', $property, $data );
489 protected function appendFileExtensions( $property ) {
490 global $wgFileExtensions;
492 $data = array();
493 foreach ( array_unique( $wgFileExtensions ) as $ext ) {
494 $data[] = array( 'ext' => $ext );
496 $this->getResult()->setIndexedTagName( $data, 'fe' );
498 return $this->getResult()->addValue( 'query', $property, $data );
501 protected function appendExtensions( $property ) {
502 global $wgExtensionCredits;
503 $data = array();
504 foreach ( $wgExtensionCredits as $type => $extensions ) {
505 foreach ( $extensions as $ext ) {
506 $ret = array();
507 $ret['type'] = $type;
508 if ( isset( $ext['name'] ) ) {
509 $ret['name'] = $ext['name'];
511 if ( isset( $ext['description'] ) ) {
512 $ret['description'] = $ext['description'];
514 if ( isset( $ext['descriptionmsg'] ) ) {
515 // Can be a string or array( key, param1, param2, ... )
516 if ( is_array( $ext['descriptionmsg'] ) ) {
517 $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
518 $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
519 $this->getResult()->setIndexedTagName( $ret['descriptionmsgparams'], 'param' );
520 } else {
521 $ret['descriptionmsg'] = $ext['descriptionmsg'];
524 if ( isset( $ext['author'] ) ) {
525 $ret['author'] = is_array( $ext['author'] ) ?
526 implode( ', ', $ext['author'] ) : $ext['author'];
528 if ( isset( $ext['url'] ) ) {
529 $ret['url'] = $ext['url'];
531 if ( isset( $ext['version'] ) ) {
532 $ret['version'] = $ext['version'];
533 } elseif ( isset( $ext['svn-revision'] ) &&
534 preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
535 $ext['svn-revision'], $m )
537 $ret['version'] = 'r' . $m[1];
539 $data[] = $ret;
543 $this->getResult()->setIndexedTagName( $data, 'ext' );
545 return $this->getResult()->addValue( 'query', $property, $data );
548 protected function appendRightsInfo( $property ) {
549 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
550 $title = Title::newFromText( $wgRightsPage );
551 $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $wgRightsUrl;
552 $text = $wgRightsText;
553 if ( !$text && $title ) {
554 $text = $title->getPrefixedText();
557 $data = array(
558 'url' => $url ? $url : '',
559 'text' => $text ? $text : ''
562 return $this->getResult()->addValue( 'query', $property, $data );
565 public function appendLanguages( $property ) {
566 $params = $this->extractRequestParams();
567 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
568 $langNames = Language::fetchLanguageNames( $langCode );
570 $data = array();
572 foreach ( $langNames as $code => $name ) {
573 $lang = array( 'code' => $code );
574 ApiResult::setContent( $lang, $name );
575 $data[] = $lang;
577 $this->getResult()->setIndexedTagName( $data, 'lang' );
579 return $this->getResult()->addValue( 'query', $property, $data );
582 public function appendSkins( $property ) {
583 $data = array();
584 $usable = Skin::getUsableSkins();
585 $default = Skin::normalizeKey( 'default' );
586 foreach ( Skin::getSkinNames() as $name => $displayName ) {
587 $skin = array( 'code' => $name );
588 ApiResult::setContent( $skin, $displayName );
589 if ( !isset( $usable[$name] ) ) {
590 $skin['unusable'] = '';
592 if ( $name === $default ) {
593 $skin['default'] = '';
595 $data[] = $skin;
597 $this->getResult()->setIndexedTagName( $data, 'skin' );
599 return $this->getResult()->addValue( 'query', $property, $data );
602 public function appendExtensionTags( $property ) {
603 global $wgParser;
604 $wgParser->firstCallInit();
605 $tags = array_map( array( $this, 'formatParserTags' ), $wgParser->getTags() );
606 $this->getResult()->setIndexedTagName( $tags, 't' );
608 return $this->getResult()->addValue( 'query', $property, $tags );
611 public function appendFunctionHooks( $property ) {
612 global $wgParser;
613 $wgParser->firstCallInit();
614 $hooks = $wgParser->getFunctionHooks();
615 $this->getResult()->setIndexedTagName( $hooks, 'h' );
617 return $this->getResult()->addValue( 'query', $property, $hooks );
620 public function appendVariables( $property ) {
621 $variables = MagicWord::getVariableIDs();
622 $this->getResult()->setIndexedTagName( $variables, 'v' );
624 return $this->getResult()->addValue( 'query', $property, $variables );
627 public function appendProtocols( $property ) {
628 global $wgUrlProtocols;
629 // Make a copy of the global so we don't try to set the _element key of it - bug 45130
630 $protocols = array_values( $wgUrlProtocols );
631 $this->getResult()->setIndexedTagName( $protocols, 'p' );
633 return $this->getResult()->addValue( 'query', $property, $protocols );
636 private function formatParserTags( $item ) {
637 return "<{$item}>";
640 public function appendSubscribedHooks( $property ) {
641 global $wgHooks;
642 $myWgHooks = $wgHooks;
643 ksort( $myWgHooks );
645 $data = array();
646 foreach ( $myWgHooks as $hook => $hooks ) {
647 $arr = array(
648 'name' => $hook,
649 'subscribers' => array_map( array( 'SpecialVersion', 'arrayToString' ), $hooks ),
652 $this->getResult()->setIndexedTagName( $arr['subscribers'], 's' );
653 $data[] = $arr;
656 $this->getResult()->setIndexedTagName( $data, 'hook' );
658 return $this->getResult()->addValue( 'query', $property, $data );
661 public function getCacheMode( $params ) {
662 return 'public';
665 public function getAllowedParams() {
666 return array(
667 'prop' => array(
668 ApiBase::PARAM_DFLT => 'general',
669 ApiBase::PARAM_ISMULTI => true,
670 ApiBase::PARAM_TYPE => array(
671 'general',
672 'namespaces',
673 'namespacealiases',
674 'specialpagealiases',
675 'magicwords',
676 'interwikimap',
677 'dbrepllag',
678 'statistics',
679 'usergroups',
680 'extensions',
681 'fileextensions',
682 'rightsinfo',
683 'languages',
684 'skins',
685 'extensiontags',
686 'functionhooks',
687 'showhooks',
688 'variables',
689 'protocols',
692 'filteriw' => array(
693 ApiBase::PARAM_TYPE => array(
694 'local',
695 '!local',
698 'showalldb' => false,
699 'numberingroup' => false,
700 'inlanguagecode' => null,
704 public function getParamDescription() {
705 $p = $this->getModulePrefix();
707 return array(
708 'prop' => array(
709 'Which sysinfo properties to get:',
710 ' general - Overall system information',
711 ' namespaces - List of registered namespaces and their canonical names',
712 ' namespacealiases - List of registered namespace aliases',
713 ' specialpagealiases - List of special page aliases',
714 ' magicwords - List of magic words and their aliases',
715 ' statistics - Returns site statistics',
716 ' interwikimap - Returns interwiki map ' .
717 "(optionally filtered, (optionally localised by using {$p}inlanguagecode))",
718 ' dbrepllag - Returns database server with the highest replication lag',
719 ' usergroups - Returns user groups and the associated permissions',
720 ' extensions - Returns extensions installed on the wiki',
721 ' fileextensions - Returns list of file extensions allowed to be uploaded',
722 ' rightsinfo - Returns wiki rights (license) information if available',
723 ' languages - Returns a list of languages MediaWiki supports' .
724 "(optionally localised by using {$p}inlanguagecode)",
725 ' skins - Returns a list of all enabled skins',
726 ' extensiontags - Returns a list of parser extension tags',
727 ' functionhooks - Returns a list of parser function hooks',
728 ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)',
729 ' variables - Returns a list of variable IDs',
730 ' protocols - Returns a list of protocols that are allowed in external links.',
732 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
733 'showalldb' => 'List all database servers, not just the one lagging the most',
734 'numberingroup' => 'Lists the number of users in user groups',
735 'inlanguagecode' => 'Language code for localised language names ' .
736 '(best effort, use CLDR extension)',
740 public function getDescription() {
741 return 'Return general information about the site';
744 public function getPossibleErrors() {
745 return array_merge( parent::getPossibleErrors(), array( array(
746 'code' => 'includeAllDenied',
747 'info' => 'Cannot view all servers info unless $wgShowHostnames is true'
748 ), ) );
751 public function getExamples() {
752 return array(
753 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
754 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
755 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb=',
759 public function getHelpUrls() {
760 return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';