MediaWiki
REL1_21
|
00001 <?php 00032 class ApiQuerySiteinfo extends ApiQueryBase { 00033 00034 public function __construct( $query, $moduleName ) { 00035 parent::__construct( $query, $moduleName, 'si' ); 00036 } 00037 00038 public function execute() { 00039 $params = $this->extractRequestParams(); 00040 $done = array(); 00041 $fit = false; 00042 foreach ( $params['prop'] as $p ) { 00043 switch ( $p ) { 00044 case 'general': 00045 $fit = $this->appendGeneralInfo( $p ); 00046 break; 00047 case 'namespaces': 00048 $fit = $this->appendNamespaces( $p ); 00049 break; 00050 case 'namespacealiases': 00051 $fit = $this->appendNamespaceAliases( $p ); 00052 break; 00053 case 'specialpagealiases': 00054 $fit = $this->appendSpecialPageAliases( $p ); 00055 break; 00056 case 'magicwords': 00057 $fit = $this->appendMagicWords( $p ); 00058 break; 00059 case 'interwikimap': 00060 $filteriw = isset( $params['filteriw'] ) ? $params['filteriw'] : false; 00061 $fit = $this->appendInterwikiMap( $p, $filteriw ); 00062 break; 00063 case 'dbrepllag': 00064 $fit = $this->appendDbReplLagInfo( $p, $params['showalldb'] ); 00065 break; 00066 case 'statistics': 00067 $fit = $this->appendStatistics( $p ); 00068 break; 00069 case 'usergroups': 00070 $fit = $this->appendUserGroups( $p, $params['numberingroup'] ); 00071 break; 00072 case 'extensions': 00073 $fit = $this->appendExtensions( $p ); 00074 break; 00075 case 'fileextensions': 00076 $fit = $this->appendFileExtensions( $p ); 00077 break; 00078 case 'rightsinfo': 00079 $fit = $this->appendRightsInfo( $p ); 00080 break; 00081 case 'languages': 00082 $fit = $this->appendLanguages( $p ); 00083 break; 00084 case 'skins': 00085 $fit = $this->appendSkins( $p ); 00086 break; 00087 case 'extensiontags': 00088 $fit = $this->appendExtensionTags( $p ); 00089 break; 00090 case 'functionhooks': 00091 $fit = $this->appendFunctionHooks( $p ); 00092 break; 00093 case 'showhooks': 00094 $fit = $this->appendSubscribedHooks( $p ); 00095 break; 00096 case 'variables': 00097 $fit = $this->appendVariables( $p ); 00098 break; 00099 case 'protocols': 00100 $fit = $this->appendProtocols( $p ); 00101 break; 00102 default: 00103 ApiBase::dieDebug( __METHOD__, "Unknown prop=$p" ); 00104 } 00105 if ( !$fit ) { 00106 // Abuse siprop as a query-continue parameter 00107 // and set it to all unprocessed props 00108 $this->setContinueEnumParameter( 'prop', implode( '|', 00109 array_diff( $params['prop'], $done ) ) ); 00110 break; 00111 } 00112 $done[] = $p; 00113 } 00114 } 00115 00116 protected function appendGeneralInfo( $property ) { 00117 global $wgContLang, 00118 $wgDisableLangConversion, 00119 $wgDisableTitleConversion; 00120 00121 $data = array(); 00122 $mainPage = Title::newMainPage(); 00123 $data['mainpage'] = $mainPage->getPrefixedText(); 00124 $data['base'] = wfExpandUrl( $mainPage->getFullUrl(), PROTO_CURRENT ); 00125 $data['sitename'] = $GLOBALS['wgSitename']; 00126 $data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}"; 00127 $data['phpversion'] = phpversion(); 00128 $data['phpsapi'] = PHP_SAPI; 00129 $data['dbtype'] = $GLOBALS['wgDBtype']; 00130 $data['dbversion'] = $this->getDB()->getServerVersion(); 00131 00132 if ( !$wgDisableLangConversion ) { 00133 $data['langconversion'] = ''; 00134 } 00135 00136 if ( !$wgDisableTitleConversion ) { 00137 $data['titleconversion'] = ''; 00138 } 00139 00140 if ( $wgContLang->linkPrefixExtension() ) { 00141 $data['linkprefix'] = wfMessage( 'linkprefix' )->inContentLanguage()->text(); 00142 } else { 00143 $data['linkprefix'] = ''; 00144 } 00145 00146 $linktrail = $wgContLang->linkTrail(); 00147 if ( $linktrail ) { 00148 $data['linktrail'] = $linktrail; 00149 } else { 00150 $data['linktrail'] = ''; 00151 } 00152 00153 $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] ); 00154 if ( $git ) { 00155 $data['git-hash'] = $git; 00156 } else { 00157 $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] ); 00158 if ( $svn ) { 00159 $data['rev'] = $svn; 00160 } 00161 } 00162 00163 // 'case-insensitive' option is reserved for future 00164 $data['case'] = $GLOBALS['wgCapitalLinks'] ? 'first-letter' : 'case-sensitive'; 00165 00166 if ( isset( $GLOBALS['wgRightsCode'] ) ) { 00167 $data['rightscode'] = $GLOBALS['wgRightsCode']; 00168 } 00169 $data['rights'] = $GLOBALS['wgRightsText']; 00170 $data['lang'] = $GLOBALS['wgLanguageCode']; 00171 00172 $fallbacks = array(); 00173 foreach( $wgContLang->getFallbackLanguages() as $code ) { 00174 $fallbacks[] = array( 'code' => $code ); 00175 } 00176 $data['fallback'] = $fallbacks; 00177 $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' ); 00178 00179 if( $wgContLang->hasVariants() ) { 00180 $variants = array(); 00181 foreach( $wgContLang->getVariants() as $code ) { 00182 $variants[] = array( 'code' => $code ); 00183 } 00184 $data['variants'] = $variants; 00185 $this->getResult()->setIndexedTagName( $data['variants'], 'lang' ); 00186 } 00187 00188 if ( $wgContLang->isRTL() ) { 00189 $data['rtl'] = ''; 00190 } 00191 $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding(); 00192 00193 if ( wfReadOnly() ) { 00194 $data['readonly'] = ''; 00195 $data['readonlyreason'] = wfReadOnlyReason(); 00196 } 00197 if ( $GLOBALS['wgEnableWriteAPI'] ) { 00198 $data['writeapi'] = ''; 00199 } 00200 00201 $tz = $GLOBALS['wgLocaltimezone']; 00202 $offset = $GLOBALS['wgLocalTZoffset']; 00203 if ( is_null( $tz ) ) { 00204 $tz = 'UTC'; 00205 $offset = 0; 00206 } elseif ( is_null( $offset ) ) { 00207 $offset = 0; 00208 } 00209 $data['timezone'] = $tz; 00210 $data['timeoffset'] = intval( $offset ); 00211 $data['articlepath'] = $GLOBALS['wgArticlePath']; 00212 $data['scriptpath'] = $GLOBALS['wgScriptPath']; 00213 $data['script'] = $GLOBALS['wgScript']; 00214 $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath']; 00215 $data['server'] = $GLOBALS['wgServer']; 00216 $data['wikiid'] = wfWikiID(); 00217 $data['time'] = wfTimestamp( TS_ISO_8601, time() ); 00218 00219 if ( $GLOBALS['wgMiserMode'] ) { 00220 $data['misermode'] = ''; 00221 } 00222 00223 $data['maxuploadsize'] = UploadBase::getMaxUploadSize(); 00224 00225 wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) ); 00226 00227 return $this->getResult()->addValue( 'query', $property, $data ); 00228 } 00229 00230 protected function appendNamespaces( $property ) { 00231 global $wgContLang; 00232 $data = array(); 00233 foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) { 00234 $data[$ns] = array( 00235 'id' => intval( $ns ), 00236 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive', 00237 ); 00238 ApiResult::setContent( $data[$ns], $title ); 00239 $canonical = MWNamespace::getCanonicalName( $ns ); 00240 00241 if ( MWNamespace::hasSubpages( $ns ) ) { 00242 $data[$ns]['subpages'] = ''; 00243 } 00244 00245 if ( $canonical ) { 00246 $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' ); 00247 } 00248 00249 if ( MWNamespace::isContent( $ns ) ) { 00250 $data[$ns]['content'] = ''; 00251 } 00252 00253 if ( MWNamespace::isNonincludable( $ns ) ) { 00254 $data[$ns]['nonincludable'] = ''; 00255 } 00256 00257 $contentmodel = MWNamespace::getNamespaceContentModel( $ns ); 00258 if ( $contentmodel ) { 00259 $data[$ns]['defaultcontentmodel'] = $contentmodel; 00260 } 00261 } 00262 00263 $this->getResult()->setIndexedTagName( $data, 'ns' ); 00264 return $this->getResult()->addValue( 'query', $property, $data ); 00265 } 00266 00267 protected function appendNamespaceAliases( $property ) { 00268 global $wgNamespaceAliases, $wgContLang; 00269 $aliases = array_merge( $wgNamespaceAliases, $wgContLang->getNamespaceAliases() ); 00270 $namespaces = $wgContLang->getNamespaces(); 00271 $data = array(); 00272 foreach ( $aliases as $title => $ns ) { 00273 if ( $namespaces[$ns] == $title ) { 00274 // Don't list duplicates 00275 continue; 00276 } 00277 $item = array( 00278 'id' => intval( $ns ) 00279 ); 00280 ApiResult::setContent( $item, strtr( $title, '_', ' ' ) ); 00281 $data[] = $item; 00282 } 00283 00284 $this->getResult()->setIndexedTagName( $data, 'ns' ); 00285 return $this->getResult()->addValue( 'query', $property, $data ); 00286 } 00287 00288 protected function appendSpecialPageAliases( $property ) { 00289 global $wgContLang; 00290 $data = array(); 00291 $aliases = $wgContLang->getSpecialPageAliases(); 00292 foreach ( SpecialPageFactory::getList() as $specialpage => $stuff ) { 00293 if ( isset( $aliases[$specialpage] ) ) { 00294 $arr = array( 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] ); 00295 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' ); 00296 $data[] = $arr; 00297 } 00298 } 00299 $this->getResult()->setIndexedTagName( $data, 'specialpage' ); 00300 return $this->getResult()->addValue( 'query', $property, $data ); 00301 } 00302 00303 protected function appendMagicWords( $property ) { 00304 global $wgContLang; 00305 $data = array(); 00306 foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) { 00307 $caseSensitive = array_shift( $aliases ); 00308 $arr = array( 'name' => $magicword, 'aliases' => $aliases ); 00309 if ( $caseSensitive ) { 00310 $arr['case-sensitive'] = ''; 00311 } 00312 $this->getResult()->setIndexedTagName( $arr['aliases'], 'alias' ); 00313 $data[] = $arr; 00314 } 00315 $this->getResult()->setIndexedTagName( $data, 'magicword' ); 00316 return $this->getResult()->addValue( 'query', $property, $data ); 00317 } 00318 00319 protected function appendInterwikiMap( $property, $filter ) { 00320 $local = null; 00321 if ( $filter === 'local' ) { 00322 $local = 1; 00323 } elseif ( $filter === '!local' ) { 00324 $local = 0; 00325 } elseif ( $filter ) { 00326 ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" ); 00327 } 00328 00329 $params = $this->extractRequestParams(); 00330 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : ''; 00331 $langNames = Language::fetchLanguageNames( $langCode ); 00332 00333 $getPrefixes = Interwiki::getAllPrefixes( $local ); 00334 $data = array(); 00335 00336 foreach ( $getPrefixes as $row ) { 00337 $prefix = $row['iw_prefix']; 00338 $val = array(); 00339 $val['prefix'] = $prefix; 00340 if ( $row['iw_local'] == '1' ) { 00341 $val['local'] = ''; 00342 } 00343 // $val['trans'] = intval( $row['iw_trans'] ); // should this be exposed? 00344 if ( isset( $langNames[$prefix] ) ) { 00345 $val['language'] = $langNames[$prefix]; 00346 } 00347 $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT ); 00348 if( isset( $row['iw_wikiid'] ) ) { 00349 $val['wikiid'] = $row['iw_wikiid']; 00350 } 00351 if( isset( $row['iw_api'] ) ) { 00352 $val['api'] = $row['iw_api']; 00353 } 00354 00355 $data[] = $val; 00356 } 00357 00358 $this->getResult()->setIndexedTagName( $data, 'iw' ); 00359 return $this->getResult()->addValue( 'query', $property, $data ); 00360 } 00361 00362 protected function appendDbReplLagInfo( $property, $includeAll ) { 00363 global $wgShowHostnames; 00364 $data = array(); 00365 $lb = wfGetLB(); 00366 if ( $includeAll ) { 00367 if ( !$wgShowHostnames ) { 00368 $this->dieUsage( 'Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied' ); 00369 } 00370 00371 $lags = $lb->getLagTimes(); 00372 foreach ( $lags as $i => $lag ) { 00373 $data[] = array( 00374 'host' => $lb->getServerName( $i ), 00375 'lag' => $lag 00376 ); 00377 } 00378 } else { 00379 list( , $lag, $index ) = $lb->getMaxLag(); 00380 $data[] = array( 00381 'host' => $wgShowHostnames 00382 ? $lb->getServerName( $index ) 00383 : '', 00384 'lag' => intval( $lag ) 00385 ); 00386 } 00387 00388 $result = $this->getResult(); 00389 $result->setIndexedTagName( $data, 'db' ); 00390 return $this->getResult()->addValue( 'query', $property, $data ); 00391 } 00392 00393 protected function appendStatistics( $property ) { 00394 global $wgDisableCounters; 00395 $data = array(); 00396 $data['pages'] = intval( SiteStats::pages() ); 00397 $data['articles'] = intval( SiteStats::articles() ); 00398 if ( !$wgDisableCounters ) { 00399 $data['views'] = intval( SiteStats::views() ); 00400 } 00401 $data['edits'] = intval( SiteStats::edits() ); 00402 $data['images'] = intval( SiteStats::images() ); 00403 $data['users'] = intval( SiteStats::users() ); 00404 $data['activeusers'] = intval( SiteStats::activeUsers() ); 00405 $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) ); 00406 $data['jobs'] = intval( SiteStats::jobs() ); 00407 return $this->getResult()->addValue( 'query', $property, $data ); 00408 } 00409 00410 protected function appendUserGroups( $property, $numberInGroup ) { 00411 global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; 00412 00413 $data = array(); 00414 $result = $this->getResult(); 00415 foreach ( $wgGroupPermissions as $group => $permissions ) { 00416 $arr = array( 00417 'name' => $group, 00418 'rights' => array_keys( $permissions, true ), 00419 ); 00420 00421 if ( $numberInGroup ) { 00422 global $wgAutopromote; 00423 00424 if ( $group == 'user' ) { 00425 $arr['number'] = SiteStats::users(); 00426 00427 // '*' and autopromote groups have no size 00428 } elseif ( $group !== '*' && !isset( $wgAutopromote[$group] ) ) { 00429 $arr['number'] = SiteStats::numberInGroup( $group ); 00430 } 00431 } 00432 00433 $groupArr = array( 00434 'add' => $wgAddGroups, 00435 'remove' => $wgRemoveGroups, 00436 'add-self' => $wgGroupsAddToSelf, 00437 'remove-self' => $wgGroupsRemoveFromSelf 00438 ); 00439 00440 foreach ( $groupArr as $type => $rights ) { 00441 if ( isset( $rights[$group] ) ) { 00442 $arr[$type] = $rights[$group]; 00443 $result->setIndexedTagName( $arr[$type], 'group' ); 00444 } 00445 } 00446 00447 $result->setIndexedTagName( $arr['rights'], 'permission' ); 00448 $data[] = $arr; 00449 } 00450 00451 $result->setIndexedTagName( $data, 'group' ); 00452 return $result->addValue( 'query', $property, $data ); 00453 } 00454 00455 protected function appendFileExtensions( $property ) { 00456 global $wgFileExtensions; 00457 00458 $data = array(); 00459 foreach ( $wgFileExtensions as $ext ) { 00460 $data[] = array( 'ext' => $ext ); 00461 } 00462 $this->getResult()->setIndexedTagName( $data, 'fe' ); 00463 return $this->getResult()->addValue( 'query', $property, $data ); 00464 } 00465 00466 protected function appendExtensions( $property ) { 00467 global $wgExtensionCredits; 00468 $data = array(); 00469 foreach ( $wgExtensionCredits as $type => $extensions ) { 00470 foreach ( $extensions as $ext ) { 00471 $ret = array(); 00472 $ret['type'] = $type; 00473 if ( isset( $ext['name'] ) ) { 00474 $ret['name'] = $ext['name']; 00475 } 00476 if ( isset( $ext['description'] ) ) { 00477 $ret['description'] = $ext['description']; 00478 } 00479 if ( isset( $ext['descriptionmsg'] ) ) { 00480 // Can be a string or array( key, param1, param2, ... ) 00481 if ( is_array( $ext['descriptionmsg'] ) ) { 00482 $ret['descriptionmsg'] = $ext['descriptionmsg'][0]; 00483 $ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 ); 00484 $this->getResult()->setIndexedTagName( $ret['descriptionmsgparams'], 'param' ); 00485 } else { 00486 $ret['descriptionmsg'] = $ext['descriptionmsg']; 00487 } 00488 } 00489 if ( isset( $ext['author'] ) ) { 00490 $ret['author'] = is_array( $ext['author'] ) ? 00491 implode( ', ', $ext['author'] ) : $ext['author']; 00492 } 00493 if ( isset( $ext['url'] ) ) { 00494 $ret['url'] = $ext['url']; 00495 } 00496 if ( isset( $ext['version'] ) ) { 00497 $ret['version'] = $ext['version']; 00498 } elseif ( isset( $ext['svn-revision'] ) && 00499 preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/', 00500 $ext['svn-revision'], $m ) ) 00501 { 00502 $ret['version'] = 'r' . $m[1]; 00503 } 00504 $data[] = $ret; 00505 } 00506 } 00507 00508 $this->getResult()->setIndexedTagName( $data, 'ext' ); 00509 return $this->getResult()->addValue( 'query', $property, $data ); 00510 } 00511 00512 protected function appendRightsInfo( $property ) { 00513 global $wgRightsPage, $wgRightsUrl, $wgRightsText; 00514 $title = Title::newFromText( $wgRightsPage ); 00515 $url = $title ? wfExpandUrl( $title->getFullURL(), PROTO_CURRENT ) : $wgRightsUrl; 00516 $text = $wgRightsText; 00517 if ( !$text && $title ) { 00518 $text = $title->getPrefixedText(); 00519 } 00520 00521 $data = array( 00522 'url' => $url ? $url : '', 00523 'text' => $text ? $text : '' 00524 ); 00525 00526 return $this->getResult()->addValue( 'query', $property, $data ); 00527 } 00528 00529 public function appendLanguages( $property ) { 00530 $params = $this->extractRequestParams(); 00531 $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : ''; 00532 $langNames = Language::fetchLanguageNames( $langCode ); 00533 00534 $data = array(); 00535 00536 foreach ( $langNames as $code => $name ) { 00537 $lang = array( 'code' => $code ); 00538 ApiResult::setContent( $lang, $name ); 00539 $data[] = $lang; 00540 } 00541 $this->getResult()->setIndexedTagName( $data, 'lang' ); 00542 return $this->getResult()->addValue( 'query', $property, $data ); 00543 } 00544 00545 public function appendSkins( $property ) { 00546 $data = array(); 00547 foreach ( Skin::getSkinNames() as $name => $displayName ) { 00548 $skin = array( 'code' => $name ); 00549 ApiResult::setContent( $skin, $displayName ); 00550 $data[] = $skin; 00551 } 00552 $this->getResult()->setIndexedTagName( $data, 'skin' ); 00553 return $this->getResult()->addValue( 'query', $property, $data ); 00554 } 00555 00556 public function appendExtensionTags( $property ) { 00557 global $wgParser; 00558 $wgParser->firstCallInit(); 00559 $tags = array_map( array( $this, 'formatParserTags' ), $wgParser->getTags() ); 00560 $this->getResult()->setIndexedTagName( $tags, 't' ); 00561 return $this->getResult()->addValue( 'query', $property, $tags ); 00562 } 00563 00564 public function appendFunctionHooks( $property ) { 00565 global $wgParser; 00566 $wgParser->firstCallInit(); 00567 $hooks = $wgParser->getFunctionHooks(); 00568 $this->getResult()->setIndexedTagName( $hooks, 'h' ); 00569 return $this->getResult()->addValue( 'query', $property, $hooks ); 00570 } 00571 00572 public function appendVariables( $property ) { 00573 $variables = MagicWord::getVariableIDs(); 00574 $this->getResult()->setIndexedTagName( $variables, 'v' ); 00575 return $this->getResult()->addValue( 'query', $property, $variables ); 00576 } 00577 00578 public function appendProtocols( $property ) { 00579 global $wgUrlProtocols; 00580 // Make a copy of the global so we don't try to set the _element key of it - bug 45130 00581 $protocols = array_values( $wgUrlProtocols ); 00582 $this->getResult()->setIndexedTagName( $protocols, 'p' ); 00583 return $this->getResult()->addValue( 'query', $property, $protocols ); 00584 } 00585 00586 private function formatParserTags( $item ) { 00587 return "<{$item}>"; 00588 } 00589 00590 public function appendSubscribedHooks( $property ) { 00591 global $wgHooks; 00592 $myWgHooks = $wgHooks; 00593 ksort( $myWgHooks ); 00594 00595 $data = array(); 00596 foreach ( $myWgHooks as $hook => $hooks ) { 00597 $arr = array( 00598 'name' => $hook, 00599 'subscribers' => array_map( array( 'SpecialVersion', 'arrayToString' ), $hooks ), 00600 ); 00601 00602 $this->getResult()->setIndexedTagName( $arr['subscribers'], 's' ); 00603 $data[] = $arr; 00604 } 00605 00606 $this->getResult()->setIndexedTagName( $data, 'hook' ); 00607 return $this->getResult()->addValue( 'query', $property, $data ); 00608 } 00609 00610 public function getCacheMode( $params ) { 00611 return 'public'; 00612 } 00613 00614 public function getAllowedParams() { 00615 return array( 00616 'prop' => array( 00617 ApiBase::PARAM_DFLT => 'general', 00618 ApiBase::PARAM_ISMULTI => true, 00619 ApiBase::PARAM_TYPE => array( 00620 'general', 00621 'namespaces', 00622 'namespacealiases', 00623 'specialpagealiases', 00624 'magicwords', 00625 'interwikimap', 00626 'dbrepllag', 00627 'statistics', 00628 'usergroups', 00629 'extensions', 00630 'fileextensions', 00631 'rightsinfo', 00632 'languages', 00633 'skins', 00634 'extensiontags', 00635 'functionhooks', 00636 'showhooks', 00637 'variables', 00638 'protocols', 00639 ) 00640 ), 00641 'filteriw' => array( 00642 ApiBase::PARAM_TYPE => array( 00643 'local', 00644 '!local', 00645 ) 00646 ), 00647 'showalldb' => false, 00648 'numberingroup' => false, 00649 'inlanguagecode' => null, 00650 ); 00651 } 00652 00653 public function getParamDescription() { 00654 $p = $this->getModulePrefix(); 00655 return array( 00656 'prop' => array( 00657 'Which sysinfo properties to get:', 00658 ' general - Overall system information', 00659 ' namespaces - List of registered namespaces and their canonical names', 00660 ' namespacealiases - List of registered namespace aliases', 00661 ' specialpagealiases - List of special page aliases', 00662 ' magicwords - List of magic words and their aliases', 00663 ' statistics - Returns site statistics', 00664 " interwikimap - Returns interwiki map (optionally filtered, (optionally localised by using {$p}inlanguagecode))", 00665 ' dbrepllag - Returns database server with the highest replication lag', 00666 ' usergroups - Returns user groups and the associated permissions', 00667 ' extensions - Returns extensions installed on the wiki', 00668 ' fileextensions - Returns list of file extensions allowed to be uploaded', 00669 ' rightsinfo - Returns wiki rights (license) information if available', 00670 " languages - Returns a list of languages MediaWiki supports (optionally localised by using {$p}inlanguagecode)", 00671 ' skins - Returns a list of all enabled skins', 00672 ' extensiontags - Returns a list of parser extension tags', 00673 ' functionhooks - Returns a list of parser function hooks', 00674 ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)', 00675 ' variables - Returns a list of variable IDs', 00676 ' protocols - Returns a list of protocols that are allowed in external links.', 00677 ), 00678 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 00679 'showalldb' => 'List all database servers, not just the one lagging the most', 00680 'numberingroup' => 'Lists the number of users in user groups', 00681 'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)', 00682 ); 00683 } 00684 00685 public function getDescription() { 00686 return 'Return general information about the site'; 00687 } 00688 00689 public function getPossibleErrors() { 00690 return array_merge( parent::getPossibleErrors(), array( 00691 array( 'code' => 'includeAllDenied', 'info' => 'Cannot view all servers info unless $wgShowHostnames is true' ), 00692 ) ); 00693 } 00694 00695 public function getExamples() { 00696 return array( 00697 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics', 00698 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local', 00699 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb=', 00700 ); 00701 } 00702 00703 public function getHelpUrls() { 00704 return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si'; 00705 } 00706 }