Merge "API: Add output of wgLogo to meta=siteinfo"
[mediawiki.git] / includes / api / ApiQuerySiteinfo.php
blob6aa311ece039236a9eedaa8b5a8282bd51215bb1
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,
118 $wgDisableLangConversion,
119 $wgDisableTitleConversion;
121 $data = array();
122 $mainPage = Title::newMainPage();
123 $data['mainpage'] = $mainPage->getPrefixedText();
124 $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT );
125 $data['sitename'] = $GLOBALS['wgSitename'];
126 $data['logo'] = $GLOBALS['wgLogo'];
127 $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
128 $data['phpversion'] = phpversion();
129 $data['phpsapi'] = PHP_SAPI;
130 $data['dbtype'] = $GLOBALS['wgDBtype'];
131 $data['dbversion'] = $this->getDB()->getServerVersion();
133 $allowFrom = array( '' );
134 $allowException = true;
135 if ( !$GLOBALS['wgAllowExternalImages'] ) {
136 if ( $GLOBALS['wgEnableImageWhitelist'] ) {
137 $data['imagewhitelistenabled'] = '';
139 $allowFrom = $GLOBALS['wgAllowExternalImagesFrom'];
140 $allowException = !empty( $allowFrom );
142 if ( $allowException ) {
143 $data['externalimages'] = (array)$allowFrom;
144 $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
147 if ( !$wgDisableLangConversion ) {
148 $data['langconversion'] = '';
151 if ( !$wgDisableTitleConversion ) {
152 $data['titleconversion'] = '';
155 if ( $wgContLang->linkPrefixExtension() ) {
156 $data['linkprefix'] = wfMessage( 'linkprefix' )->inContentLanguage()->text();
157 } else {
158 $data['linkprefix'] = '';
161 $linktrail = $wgContLang->linkTrail();
162 if ( $linktrail ) {
163 $data['linktrail'] = $linktrail;
164 } else {
165 $data['linktrail'] = '';
168 $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] );
169 if ( $git ) {
170 $data['git-hash'] = $git;
171 } else {
172 $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
173 if ( $svn ) {
174 $data['rev'] = $svn;
178 // 'case-insensitive' option is reserved for future
179 $data['case'] = $GLOBALS['wgCapitalLinks'] ? 'first-letter' : 'case-sensitive';
181 if ( isset( $GLOBALS['wgRightsCode'] ) ) {
182 $data['rightscode'] = $GLOBALS['wgRightsCode'];
184 $data['rights'] = $GLOBALS['wgRightsText'];
185 $data['lang'] = $GLOBALS['wgLanguageCode'];
187 $fallbacks = array();
188 foreach ( $wgContLang->getFallbackLanguages() as $code ) {
189 $fallbacks[] = array( 'code' => $code );
191 $data['fallback'] = $fallbacks;
192 $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
194 if ( $wgContLang->hasVariants() ) {
195 $variants = array();
196 foreach ( $wgContLang->getVariants() as $code ) {
197 $variants[] = array( 'code' => $code );
199 $data['variants'] = $variants;
200 $this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
203 if ( $wgContLang->isRTL() ) {
204 $data['rtl'] = '';
206 $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
208 if ( wfReadOnly() ) {
209 $data['readonly'] = '';
210 $data['readonlyreason'] = wfReadOnlyReason();
212 if ( $GLOBALS['wgEnableWriteAPI'] ) {
213 $data['writeapi'] = '';
216 $tz = $GLOBALS['wgLocaltimezone'];
217 $offset = $GLOBALS['wgLocalTZoffset'];
218 if ( is_null( $tz ) ) {
219 $tz = 'UTC';
220 $offset = 0;
221 } elseif ( is_null( $offset ) ) {
222 $offset = 0;
224 $data['timezone'] = $tz;
225 $data['timeoffset'] = intval( $offset );
226 $data['articlepath'] = $GLOBALS['wgArticlePath'];
227 $data['scriptpath'] = $GLOBALS['wgScriptPath'];
228 $data['script'] = $GLOBALS['wgScript'];
229 $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
230 $data['server'] = $GLOBALS['wgServer'];
231 $data['wikiid'] = wfWikiID();
232 $data['time'] = wfTimestamp( TS_ISO_8601, time() );
234 if ( $GLOBALS['wgMiserMode'] ) {
235 $data['misermode'] = '';
238 $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
240 wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
242 return $this->getResult()->addValue( 'query', $property, $data );
245 protected function appendNamespaces( $property ) {
246 global $wgContLang;
247 $data = array();
248 foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
249 $data[$ns] = array(
250 'id' => intval( $ns ),
251 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive',
253 ApiResult::setContent( $data[$ns], $title );
254 $canonical = MWNamespace::getCanonicalName( $ns );
256 if ( MWNamespace::hasSubpages( $ns ) ) {
257 $data[$ns]['subpages'] = '';
260 if ( $canonical ) {
261 $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
264 if ( MWNamespace::isContent( $ns ) ) {
265 $data[$ns]['content'] = '';
268 if ( MWNamespace::isNonincludable( $ns ) ) {
269 $data[$ns]['nonincludable'] = '';
272 $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
273 if ( $contentmodel ) {
274 $data[$ns]['defaultcontentmodel'] = $contentmodel;
278 $this->getResult()->setIndexedTagName( $data, 'ns' );
279 return $this->getResult()->addValue( 'query', $property, $data );
282 protected function appendNamespaceAliases( $property ) {
283 global $wgNamespaceAliases, $wgContLang;
284 $aliases = array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() );
285 $namespaces = $wgContLang->getNamespaces();
286 $data = array();
287 foreach ( $aliases as $title => $ns ) {
288 if ( $namespaces[$ns] == $title ) {
289 // Don't list duplicates
290 continue;
292 $item = array(
293 'id' => intval( $ns )
295 ApiResult::setContent( $item, strtr( $title, '_', ' ' ) );
296 $data[] = $item;
299 sort( $data );
301 $this->getResult()->setIndexedTagName( $data, 'ns' );
302 return $this->getResult()->addValue( 'query', $property, $data );
305 protected function appendSpecialPageAliases( $property ) {
306 global $wgContLang;
307 $data = array();
308 $aliases = $wgContLang->getSpecialPageAliases();
309 foreach ( SpecialPageFactory::getList() as $specialpage => $stuff ) {
310 if ( isset( $aliases[$specialpage] ) ) {
311 $arr = array( 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] );
312 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
313 $data[] = $arr;
316 $this->getResult()->setIndexedTagName( $data, 'specialpage' );
317 return $this->getResult()->addValue( 'query', $property, $data );
320 protected function appendMagicWords( $property ) {
321 global $wgContLang;
322 $data = array();
323 foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) {
324 $caseSensitive = array_shift( $aliases );
325 $arr = array( 'name' => $magicword, 'aliases' => $aliases );
326 if ( $caseSensitive ) {
327 $arr['case-sensitive'] = '';
329 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
330 $data[] = $arr;
332 $this->getResult()->setIndexedTagName( $data, 'magicword' );
333 return $this->getResult()->addValue( 'query', $property, $data );
336 protected function appendInterwikiMap( $property, $filter ) {
337 $local = null;
338 if ( $filter === 'local' ) {
339 $local = 1;
340 } elseif ( $filter === '!local' ) {
341 $local = 0;
342 } elseif ( $filter ) {
343 ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" );
346 $params = $this->extractRequestParams();
347 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
348 $langNames = Language::fetchLanguageNames( $langCode );
350 $getPrefixes = Interwiki::getAllPrefixes( $local );
351 $data = array();
353 foreach ( $getPrefixes as $row ) {
354 $prefix = $row['iw_prefix'];
355 $val = array();
356 $val['prefix'] = $prefix;
357 if ( $row['iw_local'] == '1' ) {
358 $val['local'] = '';
360 // $val['trans'] = intval( $row['iw_trans'] ); // should this be exposed?
361 if ( isset( $langNames[$prefix] ) ) {
362 $val['language'] = $langNames[$prefix];
364 $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
365 if ( isset( $row['iw_wikiid'] ) ) {
366 $val['wikiid'] = $row['iw_wikiid'];
368 if ( isset( $row['iw_api'] ) ) {
369 $val['api'] = $row['iw_api'];
372 $data[] = $val;
375 $this->getResult()->setIndexedTagName( $data, 'iw' );
376 return $this->getResult()->addValue( 'query', $property, $data );
379 protected function appendDbReplLagInfo( $property, $includeAll ) {
380 global $wgShowHostnames;
381 $data = array();
382 $lb = wfGetLB();
383 if ( $includeAll ) {
384 if ( !$wgShowHostnames ) {
385 $this->dieUsage( 'Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied' );
388 $lags = $lb->getLagTimes();
389 foreach ( $lags as $i => $lag ) {
390 $data[] = array(
391 'host' => $lb->getServerName( $i ),
392 'lag' => $lag
395 } else {
396 list( , $lag, $index ) = $lb->getMaxLag();
397 $data[] = array(
398 'host' => $wgShowHostnames
399 ? $lb->getServerName( $index )
400 : '',
401 'lag' => intval( $lag )
405 $result = $this->getResult();
406 $result->setIndexedTagName( $data, 'db' );
407 return $this->getResult()->addValue( 'query', $property, $data );
410 protected function appendStatistics( $property ) {
411 global $wgDisableCounters;
412 $data = array();
413 $data['pages'] = intval( SiteStats::pages() );
414 $data['articles'] = intval( SiteStats::articles() );
415 if ( !$wgDisableCounters ) {
416 $data['views'] = intval( SiteStats::views() );
418 $data['edits'] = intval( SiteStats::edits() );
419 $data['images'] = intval( SiteStats::images() );
420 $data['users'] = intval( SiteStats::users() );
421 $data['activeusers'] = intval( SiteStats::activeUsers() );
422 $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) );
423 $data['jobs'] = intval( SiteStats::jobs() );
424 return $this->getResult()->addValue( 'query', $property, $data );
427 protected function appendUserGroups( $property, $numberInGroup ) {
428 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
429 global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
431 $data = array();
432 $result = $this->getResult();
433 foreach ( $wgGroupPermissions as $group => $permissions ) {
434 $arr = array(
435 'name' => $group,
436 'rights' => array_keys( $permissions, true ),
439 if ( $numberInGroup ) {
440 global $wgAutopromote;
442 if ( $group == 'user' ) {
443 $arr['number'] = SiteStats::users();
445 // '*' and autopromote groups have no size
446 } elseif ( $group !== '*' && !isset( $wgAutopromote[$group] ) ) {
447 $arr['number'] = SiteStats::numberInGroup( $group );
451 $groupArr = array(
452 'add' => $wgAddGroups,
453 'remove' => $wgRemoveGroups,
454 'add-self' => $wgGroupsAddToSelf,
455 'remove-self' => $wgGroupsRemoveFromSelf
458 foreach ( $groupArr as $type => $rights ) {
459 if ( isset( $rights[$group] ) ) {
460 $arr[$type] = $rights[$group];
461 $result->setIndexedTagName( $arr[$type], 'group' );
465 $result->setIndexedTagName( $arr['rights'], 'permission' );
466 $data[] = $arr;
469 $result->setIndexedTagName( $data, 'group' );
470 return $result->addValue( 'query', $property, $data );
473 protected function appendFileExtensions( $property ) {
474 global $wgFileExtensions;
476 $data = array();
477 foreach ( array_unique( $wgFileExtensions ) as $ext ) {
478 $data[] = array( 'ext' => $ext );
480 $this->getResult()->setIndexedTagName( $data, 'fe' );
481 return $this->getResult()->addValue( 'query', $property, $data );
484 protected function appendExtensions( $property ) {
485 global $wgExtensionCredits;
486 $data = array();
487 foreach ( $wgExtensionCredits as $type => $extensions ) {
488 foreach ( $extensions as $ext ) {
489 $ret = array();
490 $ret['type'] = $type;
491 if ( isset( $ext['name'] ) ) {
492 $ret['name'] = $ext['name'];
494 if ( isset( $ext['description'] ) ) {
495 $ret['description'] = $ext['description'];
497 if ( isset( $ext['descriptionmsg'] ) ) {
498 // Can be a string or array( key, param1, param2, ... )
499 if ( is_array( $ext['descriptionmsg'] ) ) {
500 $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
501 $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
502 $this->getResult()->setIndexedTagName( $ret['descriptionmsgparams'], 'param' );
503 } else {
504 $ret['descriptionmsg'] = $ext['descriptionmsg'];
507 if ( isset( $ext['author'] ) ) {
508 $ret['author'] = is_array( $ext['author'] ) ?
509 implode( ', ', $ext['author'] ) : $ext['author'];
511 if ( isset( $ext['url'] ) ) {
512 $ret['url'] = $ext['url'];
514 if ( isset( $ext['version'] ) ) {
515 $ret['version'] = $ext['version'];
516 } elseif ( isset( $ext['svn-revision'] ) &&
517 preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
518 $ext['svn-revision'], $m ) )
520 $ret['version'] = 'r' . $m[1];
522 $data[] = $ret;
526 $this->getResult()->setIndexedTagName( $data, 'ext' );
527 return $this->getResult()->addValue( 'query', $property, $data );
530 protected function appendRightsInfo( $property ) {
531 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
532 $title = Title::newFromText( $wgRightsPage );
533 $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $wgRightsUrl;
534 $text = $wgRightsText;
535 if ( !$text && $title ) {
536 $text = $title->getPrefixedText();
539 $data = array(
540 'url' => $url ? $url : '',
541 'text' => $text ? $text : ''
544 return $this->getResult()->addValue( 'query', $property, $data );
547 public function appendLanguages( $property ) {
548 $params = $this->extractRequestParams();
549 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
550 $langNames = Language::fetchLanguageNames( $langCode );
552 $data = array();
554 foreach ( $langNames as $code => $name ) {
555 $lang = array( 'code' => $code );
556 ApiResult::setContent( $lang, $name );
557 $data[] = $lang;
559 $this->getResult()->setIndexedTagName( $data, 'lang' );
560 return $this->getResult()->addValue( 'query', $property, $data );
563 public function appendSkins( $property ) {
564 $data = array();
565 $usable = Skin::getUsableSkins();
566 $default = Skin::normalizeKey( 'default' );
567 foreach ( Skin::getSkinNames() as $name => $displayName ) {
568 $skin = array( 'code' => $name );
569 ApiResult::setContent( $skin, $displayName );
570 if ( !isset( $usable[$name] ) ) {
571 $skin['unusable'] = '';
573 if ( $name === $default ) {
574 $skin['default'] = '';
576 $data[] = $skin;
578 $this->getResult()->setIndexedTagName( $data, 'skin' );
579 return $this->getResult()->addValue( 'query', $property, $data );
582 public function appendExtensionTags( $property ) {
583 global $wgParser;
584 $wgParser->firstCallInit();
585 $tags = array_map( array( $this, 'formatParserTags' ), $wgParser->getTags() );
586 $this->getResult()->setIndexedTagName( $tags, 't' );
587 return $this->getResult()->addValue( 'query', $property, $tags );
590 public function appendFunctionHooks( $property ) {
591 global $wgParser;
592 $wgParser->firstCallInit();
593 $hooks = $wgParser->getFunctionHooks();
594 $this->getResult()->setIndexedTagName( $hooks, 'h' );
595 return $this->getResult()->addValue( 'query', $property, $hooks );
598 public function appendVariables( $property ) {
599 $variables = MagicWord::getVariableIDs();
600 $this->getResult()->setIndexedTagName( $variables, 'v' );
601 return $this->getResult()->addValue( 'query', $property, $variables );
604 public function appendProtocols( $property ) {
605 global $wgUrlProtocols;
606 // Make a copy of the global so we don't try to set the _element key of it - bug 45130
607 $protocols = array_values( $wgUrlProtocols );
608 $this->getResult()->setIndexedTagName( $protocols, 'p' );
609 return $this->getResult()->addValue( 'query', $property, $protocols );
612 private function formatParserTags( $item ) {
613 return "<{$item}>";
616 public function appendSubscribedHooks( $property ) {
617 global $wgHooks;
618 $myWgHooks = $wgHooks;
619 ksort( $myWgHooks );
621 $data = array();
622 foreach ( $myWgHooks as $hook => $hooks ) {
623 $arr = array(
624 'name' => $hook,
625 'subscribers' => array_map( array( 'SpecialVersion', 'arrayToString' ), $hooks ),
628 $this->getResult()->setIndexedTagName( $arr['subscribers'], 's' );
629 $data[] = $arr;
632 $this->getResult()->setIndexedTagName( $data, 'hook' );
633 return $this->getResult()->addValue( 'query', $property, $data );
636 public function getCacheMode( $params ) {
637 return 'public';
640 public function getAllowedParams() {
641 return array(
642 'prop' => array(
643 ApiBase::PARAM_DFLT => 'general',
644 ApiBase::PARAM_ISMULTI => true,
645 ApiBase::PARAM_TYPE => array(
646 'general',
647 'namespaces',
648 'namespacealiases',
649 'specialpagealiases',
650 'magicwords',
651 'interwikimap',
652 'dbrepllag',
653 'statistics',
654 'usergroups',
655 'extensions',
656 'fileextensions',
657 'rightsinfo',
658 'languages',
659 'skins',
660 'extensiontags',
661 'functionhooks',
662 'showhooks',
663 'variables',
664 'protocols',
667 'filteriw' => array(
668 ApiBase::PARAM_TYPE => array(
669 'local',
670 '!local',
673 'showalldb' => false,
674 'numberingroup' => false,
675 'inlanguagecode' => null,
679 public function getParamDescription() {
680 $p = $this->getModulePrefix();
681 return array(
682 'prop' => array(
683 'Which sysinfo properties to get:',
684 ' general - Overall system information',
685 ' namespaces - List of registered namespaces and their canonical names',
686 ' namespacealiases - List of registered namespace aliases',
687 ' specialpagealiases - List of special page aliases',
688 ' magicwords - List of magic words and their aliases',
689 ' statistics - Returns site statistics',
690 " interwikimap - Returns interwiki map " .
691 "(optionally filtered, (optionally localised by using {$p}inlanguagecode))",
692 ' dbrepllag - Returns database server with the highest replication lag',
693 ' usergroups - Returns user groups and the associated permissions',
694 ' extensions - Returns extensions installed on the wiki',
695 ' fileextensions - Returns list of file extensions allowed to be uploaded',
696 ' rightsinfo - Returns wiki rights (license) information if available',
697 " languages - Returns a list of languages MediaWiki supports" .
698 "(optionally localised by using {$p}inlanguagecode)",
699 ' skins - Returns a list of all enabled skins',
700 ' extensiontags - Returns a list of parser extension tags',
701 ' functionhooks - Returns a list of parser function hooks',
702 ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)',
703 ' variables - Returns a list of variable IDs',
704 ' protocols - Returns a list of protocols that are allowed in external links.',
706 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
707 'showalldb' => 'List all database servers, not just the one lagging the most',
708 'numberingroup' => 'Lists the number of users in user groups',
709 'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)',
713 public function getDescription() {
714 return 'Return general information about the site';
717 public function getPossibleErrors() {
718 return array_merge( parent::getPossibleErrors(), array( array(
719 'code' => 'includeAllDenied',
720 'info' => 'Cannot view all servers info unless $wgShowHostnames is true'
721 ), ) );
724 public function getExamples() {
725 return array(
726 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
727 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
728 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb=',
732 public function getHelpUrls() {
733 return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';