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
28 * A query action to return meta information about the wiki site.
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();
42 foreach ( $params['prop'] as $p ) {
45 $fit = $this->appendGeneralInfo( $p );
48 $fit = $this->appendNamespaces( $p );
50 case 'namespacealiases':
51 $fit = $this->appendNamespaceAliases( $p );
53 case 'specialpagealiases':
54 $fit = $this->appendSpecialPageAliases( $p );
57 $fit = $this->appendMagicWords( $p );
60 $filteriw = isset( $params['filteriw'] ) ?
$params['filteriw'] : false;
61 $fit = $this->appendInterwikiMap( $p, $filteriw );
64 $fit = $this->appendDbReplLagInfo( $p, $params['showalldb'] );
67 $fit = $this->appendStatistics( $p );
70 $fit = $this->appendUserGroups( $p, $params['numberingroup'] );
73 $fit = $this->appendExtensions( $p );
75 case 'fileextensions':
76 $fit = $this->appendFileExtensions( $p );
79 $fit = $this->appendRightsInfo( $p );
82 $fit = $this->appendLanguages( $p );
85 $fit = $this->appendSkins( $p );
88 $fit = $this->appendExtensionTags( $p );
91 $fit = $this->appendFunctionHooks( $p );
94 $fit = $this->appendSubscribedHooks( $p );
97 $fit = $this->appendVariables( $p );
100 $fit = $this->appendProtocols( $p );
102 case 'defaultoptions':
103 $fit = $this->appendDefaultOptions( $p );
106 ApiBase
::dieDebug( __METHOD__
, "Unknown prop=$p" );
109 // Abuse siprop as a query-continue parameter
110 // and set it to all unprocessed props
111 $this->setContinueEnumParameter( 'prop', implode( '|',
112 array_diff( $params['prop'], $done ) ) );
119 protected function appendGeneralInfo( $property ) {
120 global $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion;
123 $mainPage = Title
::newMainPage();
124 $data['mainpage'] = $mainPage->getPrefixedText();
125 $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT
);
126 $data['sitename'] = $GLOBALS['wgSitename'];
128 // wgLogo can either be a relative or an absolute path
129 // make sure we always return an absolute path
130 $data['logo'] = wfExpandUrl( $GLOBALS['wgLogo'], PROTO_RELATIVE
);
132 $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
133 $data['phpversion'] = phpversion();
134 $data['phpsapi'] = PHP_SAPI
;
135 $data['dbtype'] = $GLOBALS['wgDBtype'];
136 $data['dbversion'] = $this->getDB()->getServerVersion();
138 $allowFrom = array( '' );
139 $allowException = true;
140 if ( !$GLOBALS['wgAllowExternalImages'] ) {
141 if ( $GLOBALS['wgEnableImageWhitelist'] ) {
142 $data['imagewhitelistenabled'] = '';
144 $allowFrom = $GLOBALS['wgAllowExternalImagesFrom'];
145 $allowException = !empty( $allowFrom );
147 if ( $allowException ) {
148 $data['externalimages'] = (array)$allowFrom;
149 $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
152 if ( !$wgDisableLangConversion ) {
153 $data['langconversion'] = '';
156 if ( !$wgDisableTitleConversion ) {
157 $data['titleconversion'] = '';
160 if ( $wgContLang->linkPrefixExtension() ) {
161 $linkPrefixCharset = $wgContLang->linkPrefixCharset();
162 $data['linkprefixcharset'] = $linkPrefixCharset;
163 // For backwards compatability
164 $data['linkprefix'] = "/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
166 $data['linkprefixcharset'] = '';
167 $data['linkprefix'] = '';
170 $linktrail = $wgContLang->linkTrail();
172 $data['linktrail'] = $linktrail;
174 $data['linktrail'] = '';
177 $git = SpecialVersion
::getGitHeadSha1( $GLOBALS['IP'] );
179 $data['git-hash'] = $git;
181 $svn = SpecialVersion
::getSvnRevision( $GLOBALS['IP'] );
187 // 'case-insensitive' option is reserved for future
188 $data['case'] = $GLOBALS['wgCapitalLinks'] ?
'first-letter' : 'case-sensitive';
190 $data['lang'] = $GLOBALS['wgLanguageCode'];
192 $fallbacks = array();
193 foreach ( $wgContLang->getFallbackLanguages() as $code ) {
194 $fallbacks[] = array( 'code' => $code );
196 $data['fallback'] = $fallbacks;
197 $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
199 if ( $wgContLang->hasVariants() ) {
201 foreach ( $wgContLang->getVariants() as $code ) {
204 'name' => $wgContLang->getVariantname( $code ),
207 $data['variants'] = $variants;
208 $this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
211 if ( $wgContLang->isRTL() ) {
214 $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
216 if ( wfReadOnly() ) {
217 $data['readonly'] = '';
218 $data['readonlyreason'] = wfReadOnlyReason();
220 if ( $GLOBALS['wgEnableWriteAPI'] ) {
221 $data['writeapi'] = '';
224 $tz = $GLOBALS['wgLocaltimezone'];
225 $offset = $GLOBALS['wgLocalTZoffset'];
226 if ( is_null( $tz ) ) {
229 } elseif ( is_null( $offset ) ) {
232 $data['timezone'] = $tz;
233 $data['timeoffset'] = intval( $offset );
234 $data['articlepath'] = $GLOBALS['wgArticlePath'];
235 $data['scriptpath'] = $GLOBALS['wgScriptPath'];
236 $data['script'] = $GLOBALS['wgScript'];
237 $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
238 $data['server'] = $GLOBALS['wgServer'];
239 $data['wikiid'] = wfWikiID();
240 $data['time'] = wfTimestamp( TS_ISO_8601
, time() );
242 if ( $GLOBALS['wgMiserMode'] ) {
243 $data['misermode'] = '';
246 $data['maxuploadsize'] = UploadBase
::getMaxUploadSize();
248 $data['thumblimits'] = $GLOBALS['wgThumbLimits'];
249 $this->getResult()->setIndexedTagName( $data['thumblimits'], 'limit' );
250 $data['imagelimits'] = array();
251 $this->getResult()->setIndexedTagName( $data['imagelimits'], 'limit' );
252 foreach ( $GLOBALS['wgImageLimits'] as $k => $limit ) {
253 $data['imagelimits'][$k] = array( 'width' => $limit[0], 'height' => $limit[1] );
256 if ( !empty( $GLOBALS['wgFavicon'] ) ) {
257 // wgFavicon can either be a relative or an absolute path
258 // make sure we always return an absolute path
259 $data['favicon'] = wfExpandUrl( $GLOBALS['wgFavicon'], PROTO_RELATIVE
);
262 wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
264 return $this->getResult()->addValue( 'query', $property, $data );
267 protected function appendNamespaces( $property ) {
270 foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
272 'id' => intval( $ns ),
273 'case' => MWNamespace
::isCapitalized( $ns ) ?
'first-letter' : 'case-sensitive',
275 ApiResult
::setContent( $data[$ns], $title );
276 $canonical = MWNamespace
::getCanonicalName( $ns );
278 if ( MWNamespace
::hasSubpages( $ns ) ) {
279 $data[$ns]['subpages'] = '';
283 $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' );
286 if ( MWNamespace
::isContent( $ns ) ) {
287 $data[$ns]['content'] = '';
290 if ( MWNamespace
::isNonincludable( $ns ) ) {
291 $data[$ns]['nonincludable'] = '';
294 $contentmodel = MWNamespace
::getNamespaceContentModel( $ns );
295 if ( $contentmodel ) {
296 $data[$ns]['defaultcontentmodel'] = $contentmodel;
300 $this->getResult()->setIndexedTagName( $data, 'ns' );
302 return $this->getResult()->addValue( 'query', $property, $data );
305 protected function appendNamespaceAliases( $property ) {
306 global $wgNamespaceAliases, $wgContLang;
307 $aliases = array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() );
308 $namespaces = $wgContLang->getNamespaces();
310 foreach ( $aliases as $title => $ns ) {
311 if ( $namespaces[$ns] == $title ) {
312 // Don't list duplicates
316 'id' => intval( $ns )
318 ApiResult
::setContent( $item, strtr( $title, '_', ' ' ) );
324 $this->getResult()->setIndexedTagName( $data, 'ns' );
326 return $this->getResult()->addValue( 'query', $property, $data );
329 protected function appendSpecialPageAliases( $property ) {
332 $aliases = $wgContLang->getSpecialPageAliases();
333 foreach ( SpecialPageFactory
::getList() as $specialpage => $stuff ) {
334 if ( isset( $aliases[$specialpage] ) ) {
335 $arr = array( 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] );
336 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
340 $this->getResult()->setIndexedTagName( $data, 'specialpage' );
342 return $this->getResult()->addValue( 'query', $property, $data );
345 protected function appendMagicWords( $property ) {
348 foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) {
349 $caseSensitive = array_shift( $aliases );
350 $arr = array( 'name' => $magicword, 'aliases' => $aliases );
351 if ( $caseSensitive ) {
352 $arr['case-sensitive'] = '';
354 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' );
357 $this->getResult()->setIndexedTagName( $data, 'magicword' );
359 return $this->getResult()->addValue( 'query', $property, $data );
362 protected function appendInterwikiMap( $property, $filter ) {
364 if ( $filter === 'local' ) {
366 } elseif ( $filter === '!local' ) {
368 } elseif ( $filter ) {
369 ApiBase
::dieDebug( __METHOD__
, "Unknown filter=$filter" );
372 $params = $this->extractRequestParams();
373 $langCode = isset( $params['inlanguagecode'] ) ?
$params['inlanguagecode'] : '';
374 $langNames = Language
::fetchLanguageNames( $langCode );
376 $getPrefixes = Interwiki
::getAllPrefixes( $local );
379 foreach ( $getPrefixes as $row ) {
380 $prefix = $row['iw_prefix'];
382 $val['prefix'] = $prefix;
383 if ( $row['iw_local'] == '1' ) {
386 if ( $row['iw_trans'] == '1' ) {
389 if ( isset( $langNames[$prefix] ) ) {
390 $val['language'] = $langNames[$prefix];
392 $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT
);
393 if ( isset( $row['iw_wikiid'] ) ) {
394 $val['wikiid'] = $row['iw_wikiid'];
396 if ( isset( $row['iw_api'] ) ) {
397 $val['api'] = $row['iw_api'];
403 $this->getResult()->setIndexedTagName( $data, 'iw' );
405 return $this->getResult()->addValue( 'query', $property, $data );
408 protected function appendDbReplLagInfo( $property, $includeAll ) {
409 global $wgShowHostnames;
413 if ( !$wgShowHostnames ) {
415 'Cannot view all servers info unless $wgShowHostnames is true',
420 $lags = $lb->getLagTimes();
421 foreach ( $lags as $i => $lag ) {
423 'host' => $lb->getServerName( $i ),
428 list( , $lag, $index ) = $lb->getMaxLag();
430 'host' => $wgShowHostnames
431 ?
$lb->getServerName( $index )
433 'lag' => intval( $lag )
437 $result = $this->getResult();
438 $result->setIndexedTagName( $data, 'db' );
440 return $this->getResult()->addValue( 'query', $property, $data );
443 protected function appendStatistics( $property ) {
444 global $wgDisableCounters;
446 $data['pages'] = intval( SiteStats
::pages() );
447 $data['articles'] = intval( SiteStats
::articles() );
448 if ( !$wgDisableCounters ) {
449 $data['views'] = intval( SiteStats
::views() );
451 $data['edits'] = intval( SiteStats
::edits() );
452 $data['images'] = intval( SiteStats
::images() );
453 $data['users'] = intval( SiteStats
::users() );
454 $data['activeusers'] = intval( SiteStats
::activeUsers() );
455 $data['admins'] = intval( SiteStats
::numberingroup( 'sysop' ) );
456 $data['jobs'] = intval( SiteStats
::jobs() );
458 wfRunHooks( 'APIQuerySiteInfoStatisticsInfo', array( &$data ) );
460 return $this->getResult()->addValue( 'query', $property, $data );
463 protected function appendUserGroups( $property, $numberInGroup ) {
464 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
465 global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
468 $result = $this->getResult();
469 foreach ( $wgGroupPermissions as $group => $permissions ) {
472 'rights' => array_keys( $permissions, true ),
475 if ( $numberInGroup ) {
476 global $wgAutopromote;
478 if ( $group == 'user' ) {
479 $arr['number'] = SiteStats
::users();
480 // '*' and autopromote groups have no size
481 } elseif ( $group !== '*' && !isset( $wgAutopromote[$group] ) ) {
482 $arr['number'] = SiteStats
::numberInGroup( $group );
487 'add' => $wgAddGroups,
488 'remove' => $wgRemoveGroups,
489 'add-self' => $wgGroupsAddToSelf,
490 'remove-self' => $wgGroupsRemoveFromSelf
493 foreach ( $groupArr as $type => $rights ) {
494 if ( isset( $rights[$group] ) ) {
495 $arr[$type] = $rights[$group];
496 $result->setIndexedTagName( $arr[$type], 'group' );
500 $result->setIndexedTagName( $arr['rights'], 'permission' );
504 $result->setIndexedTagName( $data, 'group' );
506 return $result->addValue( 'query', $property, $data );
509 protected function appendFileExtensions( $property ) {
510 global $wgFileExtensions;
513 foreach ( array_unique( $wgFileExtensions ) as $ext ) {
514 $data[] = array( 'ext' => $ext );
516 $this->getResult()->setIndexedTagName( $data, 'fe' );
518 return $this->getResult()->addValue( 'query', $property, $data );
521 protected function appendExtensions( $property ) {
522 global $wgExtensionCredits;
524 foreach ( $wgExtensionCredits as $type => $extensions ) {
525 foreach ( $extensions as $ext ) {
527 $ret['type'] = $type;
528 if ( isset( $ext['name'] ) ) {
529 $ret['name'] = $ext['name'];
531 if ( isset( $ext['description'] ) ) {
532 $ret['description'] = $ext['description'];
534 if ( isset( $ext['descriptionmsg'] ) ) {
535 // Can be a string or array( key, param1, param2, ... )
536 if ( is_array( $ext['descriptionmsg'] ) ) {
537 $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
538 $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
539 $this->getResult()->setIndexedTagName( $ret['descriptionmsgparams'], 'param' );
541 $ret['descriptionmsg'] = $ext['descriptionmsg'];
544 if ( isset( $ext['author'] ) ) {
545 $ret['author'] = is_array( $ext['author'] ) ?
546 implode( ', ', $ext['author'] ) : $ext['author'];
548 if ( isset( $ext['url'] ) ) {
549 $ret['url'] = $ext['url'];
551 if ( isset( $ext['version'] ) ) {
552 $ret['version'] = $ext['version'];
553 } elseif ( isset( $ext['svn-revision'] ) &&
554 preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
555 $ext['svn-revision'], $m )
557 $ret['version'] = 'r' . $m[1];
559 if ( isset( $ext['path'] ) ) {
560 $extensionPath = dirname( $ext['path'] );
561 $gitInfo = new GitInfo( $extensionPath );
562 $vcsVersion = $gitInfo->getHeadSHA1();
563 if ( $vcsVersion !== false ) {
564 $ret['vcs-system'] = 'git';
565 $ret['vcs-version'] = $vcsVersion;
566 $ret['vcs-url'] = $gitInfo->getHeadViewUrl();
567 $ret['vcs-date'] = wfTimestamp( TS_ISO_8601
, $gitInfo->getHeadCommitDate() );
569 $svnInfo = SpecialVersion
::getSvnInfo( $extensionPath );
570 if ( $svnInfo !== false ) {
571 $ret['vcs-system'] = 'svn';
572 $ret['vcs-version'] = $svnInfo['checkout-rev'];
573 $ret['vcs-url'] = isset( $svnInfo['viewvc-url'] ) ?
$svnInfo['viewvc-url'] : '';
576 if ( SpecialVersion
::getExtLicenseFileName( $extensionPath ) ) {
577 $ret['license-name'] = isset( $ext['license-name'] ) ?
$ext['license-name'] : '';
578 $ret['license'] = SpecialPage
::getTitleFor( 'Version', "License/{$ext['name']}" )->getLinkURL();
580 if ( SpecialVersion
::getExtAuthorsFileName( $extensionPath ) ) {
581 $ret['credits'] = SpecialPage
::getTitleFor( 'Version', "Credits/{$ext['name']}" )->getLinkURL();
588 $this->getResult()->setIndexedTagName( $data, 'ext' );
590 return $this->getResult()->addValue( 'query', $property, $data );
593 protected function appendRightsInfo( $property ) {
594 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
595 $title = Title
::newFromText( $wgRightsPage );
596 $url = $title ?
wfExpandUrl( $title->getFullURL(), PROTO_CURRENT
) : $wgRightsUrl;
597 $text = $wgRightsText;
598 if ( !$text && $title ) {
599 $text = $title->getPrefixedText();
603 'url' => $url ?
$url : '',
604 'text' => $text ?
$text : ''
607 return $this->getResult()->addValue( 'query', $property, $data );
610 public function appendLanguages( $property ) {
611 $params = $this->extractRequestParams();
612 $langCode = isset( $params['inlanguagecode'] ) ?
$params['inlanguagecode'] : '';
613 $langNames = Language
::fetchLanguageNames( $langCode );
617 foreach ( $langNames as $code => $name ) {
618 $lang = array( 'code' => $code );
619 ApiResult
::setContent( $lang, $name );
622 $this->getResult()->setIndexedTagName( $data, 'lang' );
624 return $this->getResult()->addValue( 'query', $property, $data );
627 public function appendSkins( $property ) {
629 $usable = Skin
::getUsableSkins();
630 $default = Skin
::normalizeKey( 'default' );
631 foreach ( Skin
::getSkinNames() as $name => $displayName ) {
632 $skin = array( 'code' => $name );
633 ApiResult
::setContent( $skin, $displayName );
634 if ( !isset( $usable[$name] ) ) {
635 $skin['unusable'] = '';
637 if ( $name === $default ) {
638 $skin['default'] = '';
642 $this->getResult()->setIndexedTagName( $data, 'skin' );
644 return $this->getResult()->addValue( 'query', $property, $data );
647 public function appendExtensionTags( $property ) {
649 $wgParser->firstCallInit();
650 $tags = array_map( array( $this, 'formatParserTags' ), $wgParser->getTags() );
651 $this->getResult()->setIndexedTagName( $tags, 't' );
653 return $this->getResult()->addValue( 'query', $property, $tags );
656 public function appendFunctionHooks( $property ) {
658 $wgParser->firstCallInit();
659 $hooks = $wgParser->getFunctionHooks();
660 $this->getResult()->setIndexedTagName( $hooks, 'h' );
662 return $this->getResult()->addValue( 'query', $property, $hooks );
665 public function appendVariables( $property ) {
666 $variables = MagicWord
::getVariableIDs();
667 $this->getResult()->setIndexedTagName( $variables, 'v' );
669 return $this->getResult()->addValue( 'query', $property, $variables );
672 public function appendProtocols( $property ) {
673 global $wgUrlProtocols;
674 // Make a copy of the global so we don't try to set the _element key of it - bug 45130
675 $protocols = array_values( $wgUrlProtocols );
676 $this->getResult()->setIndexedTagName( $protocols, 'p' );
678 return $this->getResult()->addValue( 'query', $property, $protocols );
681 public function appendDefaultOptions( $property ) {
682 return $this->getResult()->addValue( 'query', $property, User
::getDefaultOptions() );
685 private function formatParserTags( $item ) {
689 public function appendSubscribedHooks( $property ) {
691 $myWgHooks = $wgHooks;
695 foreach ( $myWgHooks as $hook => $hooks ) {
698 'subscribers' => array_map( array( 'SpecialVersion', 'arrayToString' ), $hooks ),
701 $this->getResult()->setIndexedTagName( $arr['subscribers'], 's' );
705 $this->getResult()->setIndexedTagName( $data, 'hook' );
707 return $this->getResult()->addValue( 'query', $property, $data );
710 public function getCacheMode( $params ) {
714 public function getAllowedParams() {
717 ApiBase
::PARAM_DFLT
=> 'general',
718 ApiBase
::PARAM_ISMULTI
=> true,
719 ApiBase
::PARAM_TYPE
=> array(
723 'specialpagealiases',
743 ApiBase
::PARAM_TYPE
=> array(
748 'showalldb' => false,
749 'numberingroup' => false,
750 'inlanguagecode' => null,
754 public function getParamDescription() {
755 $p = $this->getModulePrefix();
759 'Which sysinfo properties to get:',
760 ' general - Overall system information',
761 ' namespaces - List of registered namespaces and their canonical names',
762 ' namespacealiases - List of registered namespace aliases',
763 ' specialpagealiases - List of special page aliases',
764 ' magicwords - List of magic words and their aliases',
765 ' statistics - Returns site statistics',
766 ' interwikimap - Returns interwiki map ' .
767 "(optionally filtered, (optionally localised by using {$p}inlanguagecode))",
768 ' dbrepllag - Returns database server with the highest replication lag',
769 ' usergroups - Returns user groups and the associated permissions',
770 ' extensions - Returns extensions installed on the wiki',
771 ' fileextensions - Returns list of file extensions allowed to be uploaded',
772 ' rightsinfo - Returns wiki rights (license) information if available',
773 ' languages - Returns a list of languages MediaWiki supports' .
774 "(optionally localised by using {$p}inlanguagecode)",
775 ' skins - Returns a list of all enabled skins',
776 ' extensiontags - Returns a list of parser extension tags',
777 ' functionhooks - Returns a list of parser function hooks',
778 ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)',
779 ' variables - Returns a list of variable IDs',
780 ' protocols - Returns a list of protocols that are allowed in external links.',
781 ' defaultoptions - Returns the default values for user preferences.',
783 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
784 'showalldb' => 'List all database servers, not just the one lagging the most',
785 'numberingroup' => 'Lists the number of users in user groups',
786 'inlanguagecode' => 'Language code for localised language names ' .
787 '(best effort, use CLDR extension)',
791 public function getDescription() {
792 return 'Return general information about the site';
795 public function getPossibleErrors() {
796 return array_merge( parent
::getPossibleErrors(), array( array(
797 'code' => 'includeAllDenied',
798 'info' => 'Cannot view all servers info unless $wgShowHostnames is true'
802 public function getExamples() {
804 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
805 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
806 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb=',
810 public function getHelpUrls() {
811 return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';