44 private $userOptionsLookup;
47 private $userGroupManager;
50 private $languageConverterFactory;
53 private $languageFactory;
56 private $languageNameUtils;
59 private $contentLanguage;
62 private $namespaceInfo;
65 private $interwikiLookup;
71 private $magicWordFactory;
74 private $specialPageFactory;
80 private $loadBalancer;
83 private $readOnlyMode;
121 parent::__construct( $query, $moduleName,
'si' );
122 $this->userOptionsLookup = $userOptionsLookup;
123 $this->userGroupManager = $userGroupManager;
124 $this->languageConverterFactory = $languageConverterFactory;
125 $this->languageFactory = $languageFactory;
126 $this->languageNameUtils = $languageNameUtils;
127 $this->contentLanguage = $contentLanguage;
128 $this->namespaceInfo = $namespaceInfo;
129 $this->interwikiLookup = $interwikiLookup;
130 $this->parser = $parser;
131 $this->magicWordFactory = $magicWordFactory;
132 $this->specialPageFactory = $specialPageFactory;
133 $this->skinFactory = $skinFactory;
134 $this->loadBalancer = $loadBalancer;
135 $this->readOnlyMode = $readOnlyMode;
142 foreach ( $params[
'prop'] as $p ) {
150 case 'namespacealiases':
153 case 'specialpagealiases':
177 case 'fileextensions':
189 case 'languagevariants':
195 case 'extensiontags':
198 case 'functionhooks':
210 case 'defaultoptions':
223 array_diff( $params[
'prop'], $done ) ) );
234 $mainPage = Title::newMainPage();
235 $data[
'mainpage'] = $mainPage->getPrefixedText();
237 $data[
'sitename'] = $config->get( MainConfigNames::Sitename );
238 $data[
'mainpageisdomainroot'] = (bool)$config->get( MainConfigNames::MainPageIsDomainRoot );
242 $logo = SkinModule::getAvailableLogos( $config );
245 $data[
'generator'] =
'MediaWiki ' .
MW_VERSION;
247 $data[
'phpversion'] = PHP_VERSION;
248 $data[
'phpsapi'] = PHP_SAPI;
249 $data[
'dbtype'] = $config->get( MainConfigNames::DBtype );
250 $data[
'dbversion'] = $this->
getDB()->getServerVersion();
253 $allowException =
true;
254 if ( !$config->get( MainConfigNames::AllowExternalImages ) ) {
255 $data[
'imagewhitelistenabled'] =
256 (bool)$config->get( MainConfigNames::EnableImageWhitelist );
257 $allowFrom = $config->get( MainConfigNames::AllowExternalImagesFrom );
258 $allowException = !empty( $allowFrom );
260 if ( $allowException ) {
261 $data[
'externalimages'] = (array)$allowFrom;
262 ApiResult::setIndexedTagName( $data[
'externalimages'],
'prefix' );
265 $data[
'langconversion'] = !$this->languageConverterFactory->isConversionDisabled();
266 $data[
'linkconversion'] = !$this->languageConverterFactory->isLinkConversionDisabled();
268 $data[
'titleconversion'] = $data[
'linkconversion'];
270 $contLangConverter = $this->languageConverterFactory->getLanguageConverter( $this->contentLanguage );
271 if ( $this->contentLanguage->linkPrefixExtension() ) {
275 $data[
'linkprefix'] =
"/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
277 $data[
'linkprefixcharset'] =
'';
278 $data[
'linkprefix'] =
'';
281 $linktrail = $this->contentLanguage->linkTrail();
282 $data[
'linktrail'] = $linktrail ?:
'';
284 $data[
'legaltitlechars'] = Title::legalChars();
285 $data[
'invalidusernamechars'] = $config->get( MainConfigNames::InvalidUsernameCharacters );
287 $data[
'allunicodefixes'] = (bool)$config->get( MainConfigNames::AllUnicodeFixes );
288 $data[
'fixarabicunicode'] =
true;
289 $data[
'fixmalayalamunicode'] =
true;
291 $baseDir = $this->
getConfig()->get( MainConfigNames::BaseDirectory );
294 $data[
'git-hash'] = $git;
295 $data[
'git-branch'] =
301 $config->get( MainConfigNames::CapitalLinks ) ?
'first-letter' :
'case-sensitive';
302 $data[
'lang'] = $config->get( MainConfigNames::LanguageCode );
305 foreach ( $this->contentLanguage->getFallbackLanguages() as $code ) {
306 $fallbacks[] = [
'code' => $code ];
308 $data[
'fallback'] = $fallbacks;
309 ApiResult::setIndexedTagName( $data[
'fallback'],
'lang' );
311 if ( $contLangConverter->hasVariants() ) {
313 foreach ( $contLangConverter->getVariants() as $code ) {
316 'name' => $this->contentLanguage->getVariantname( $code ),
319 $data[
'variants'] = $variants;
320 ApiResult::setIndexedTagName( $data[
'variants'],
'lang' );
323 $data[
'rtl'] = $this->contentLanguage->isRTL();
324 $data[
'fallback8bitEncoding'] = $this->contentLanguage->fallback8bitEncoding();
326 $data[
'readonly'] = $this->readOnlyMode->isReadOnly();
327 if ( $data[
'readonly'] ) {
328 $data[
'readonlyreason'] = $this->readOnlyMode->getReason();
330 $data[
'writeapi'] =
true;
332 $data[
'maxarticlesize'] = $config->get( MainConfigNames::MaxArticleSize ) * 1024;
334 $tz = $config->get( MainConfigNames::Localtimezone );
335 $offset = $config->get( MainConfigNames::LocalTZoffset );
336 $data[
'timezone'] = $tz;
337 $data[
'timeoffset'] = (int)$offset;
338 $data[
'articlepath'] = $config->get( MainConfigNames::ArticlePath );
339 $data[
'scriptpath'] = $config->get( MainConfigNames::ScriptPath );
340 $data[
'script'] = $config->get( MainConfigNames::Script );
341 $data[
'variantarticlepath'] = $config->get( MainConfigNames::VariantArticlePath );
342 $data[ApiResult::META_BC_BOOLS][] =
'variantarticlepath';
343 $data[
'server'] = $config->get( MainConfigNames::Server );
344 $data[
'servername'] = $config->get( MainConfigNames::ServerName );
345 $data[
'wikiid'] = WikiMap::getCurrentWikiId();
346 $data[
'time'] =
wfTimestamp( TS_ISO_8601, time() );
348 $data[
'misermode'] = (bool)$config->get( MainConfigNames::MiserMode );
350 $data[
'uploadsenabled'] = UploadBase::isEnabled();
351 $data[
'maxuploadsize'] = UploadBase::getMaxUploadSize();
354 $data[
'galleryoptions'] = $config->get( MainConfigNames::GalleryOptions );
356 $data[
'thumblimits'] = $config->get( MainConfigNames::ThumbLimits );
357 ApiResult::setArrayType( $data[
'thumblimits'],
'BCassoc' );
358 ApiResult::setIndexedTagName( $data[
'thumblimits'],
'limit' );
359 $data[
'imagelimits'] = [];
360 ApiResult::setArrayType( $data[
'imagelimits'],
'BCassoc' );
361 ApiResult::setIndexedTagName( $data[
'imagelimits'],
'limit' );
362 foreach ( $config->get( MainConfigNames::ImageLimits ) as $k => $limit ) {
363 $data[
'imagelimits'][$k] = [
'width' => $limit[0],
'height' => $limit[1] ];
366 $favicon = $config->get( MainConfigNames::Favicon );
372 $data[
'centralidlookupprovider'] =
373 $config->get( MainConfigNames::CentralIdLookupProvider );
374 $providerIds = array_keys( $config->get( MainConfigNames::CentralIdLookupProviders ) );
375 $data[
'allcentralidlookupproviders'] = $providerIds;
377 $data[
'interwikimagic'] = (bool)$config->get( MainConfigNames::InterwikiMagic );
378 $data[
'magiclinks'] = $config->get( MainConfigNames::EnableMagicLinks );
380 $data[
'categorycollation'] = $config->get( MainConfigNames::CategoryCollation );
382 $data[
'nofollowlinks'] = $config->get( MainConfigNames::NoFollowLinks );
383 $data[
'nofollownsexceptions'] = $config->get( MainConfigNames::NoFollowNsExceptions );
384 $data[
'nofollowdomainexceptions'] = $config->get( MainConfigNames::NoFollowDomainExceptions );
385 $data[
'externallinktarget'] = $config->get( MainConfigNames::ExternalLinkTarget );
387 $this->
getHookRunner()->onAPIQuerySiteInfoGeneralInfo( $this, $data );
389 return $this->
getResult()->addValue(
'query', $property, $data );
393 $nsProtection = $this->
getConfig()->get( MainConfigNames::NamespaceProtection );
396 ApiResult::META_TYPE =>
'assoc',
399 $this->contentLanguage->getFormattedNamespaces()
404 'case' => $this->namespaceInfo->isCapitalized( $ns ) ?
'first-letter' :
'case-sensitive',
406 ApiResult::setContentValue( $data[$ns],
'name',
$title );
407 $canonical = $this->namespaceInfo->getCanonicalName( $ns );
409 $data[$ns][
'subpages'] = $this->namespaceInfo->hasSubpages( $ns );
412 $data[$ns][
'canonical'] = strtr( $canonical,
'_',
' ' );
415 $data[$ns][
'content'] = $this->namespaceInfo->isContent( $ns );
416 $data[$ns][
'nonincludable'] = $this->namespaceInfo->isNonincludable( $ns );
418 if ( isset( $nsProtection[$ns] ) ) {
419 if ( is_array( $nsProtection[$ns] ) ) {
420 $specificNs = implode(
"|", array_filter( $nsProtection[$ns] ) );
421 } elseif ( $nsProtection[$ns] !==
'' ) {
422 $specificNs = $nsProtection[$ns];
424 if ( isset( $specificNs ) && $specificNs !==
'' ) {
425 $data[$ns][
'namespaceprotection'] = $specificNs;
429 $contentmodel = $this->namespaceInfo->getNamespaceContentModel( $ns );
430 if ( $contentmodel ) {
431 $data[$ns][
'defaultcontentmodel'] = $contentmodel;
435 ApiResult::setArrayType( $data,
'assoc' );
436 ApiResult::setIndexedTagName( $data,
'ns' );
438 return $this->
getResult()->addValue(
'query', $property, $data );
442 $aliases = $this->contentLanguage->getNamespaceAliases();
443 $namespaces = $this->contentLanguage->getNamespaces();
445 foreach ( $aliases as
$title => $ns ) {
446 if ( $namespaces[$ns] ==
$title ) {
453 ApiResult::setContentValue( $item,
'alias', strtr(
$title,
'_',
' ' ) );
459 ApiResult::setIndexedTagName( $data,
'ns' );
461 return $this->
getResult()->addValue(
'query', $property, $data );
466 $aliases = $this->contentLanguage->getSpecialPageAliases();
467 foreach ( $this->specialPageFactory->getNames() as $specialpage ) {
468 if ( isset( $aliases[$specialpage] ) ) {
469 $arr = [
'realname' => $specialpage,
'aliases' => $aliases[$specialpage] ];
470 ApiResult::setIndexedTagName( $arr[
'aliases'],
'alias' );
474 ApiResult::setIndexedTagName( $data,
'specialpage' );
476 return $this->
getResult()->addValue(
'query', $property, $data );
482 $this->contentLanguage->getMagicWords()
483 as $magicword => $aliases
485 $caseSensitive = array_shift( $aliases );
486 $arr = [
'name' => $magicword,
'aliases' => $aliases ];
487 $arr[
'case-sensitive'] = (bool)$caseSensitive;
488 ApiResult::setIndexedTagName( $arr[
'aliases'],
'alias' );
491 ApiResult::setIndexedTagName( $data,
'magicword' );
493 return $this->
getResult()->addValue(
'query', $property, $data );
497 if ( $filter ===
'local' ) {
499 } elseif ( $filter ===
'!local' ) {
507 $langCode = $params[
'inlanguagecode'] ??
'';
508 $interwikiMagic = $this->
getConfig()->get( MainConfigNames::InterwikiMagic );
510 if ( $interwikiMagic ) {
511 $langNames = $this->languageNameUtils->getLanguageNames( $langCode );
514 $getPrefixes = $this->interwikiLookup->getAllPrefixes( $local );
515 $extraLangPrefixes = $this->
getConfig()->get( MainConfigNames::ExtraInterlanguageLinkPrefixes );
516 $localInterwikis = $this->
getConfig()->get( MainConfigNames::LocalInterwikis );
519 foreach ( $getPrefixes as $row ) {
520 $prefix = $row[
'iw_prefix'];
522 $val[
'prefix'] = $prefix;
523 if ( isset( $row[
'iw_local'] ) && $row[
'iw_local'] ==
'1' ) {
524 $val[
'local'] =
true;
526 if ( isset( $row[
'iw_trans'] ) && $row[
'iw_trans'] ==
'1' ) {
527 $val[
'trans'] =
true;
530 if ( $interwikiMagic && isset( $langNames[$prefix] ) ) {
531 $val[
'language'] = $langNames[$prefix];
533 if ( in_array( $prefix, $localInterwikis ) ) {
534 $val[
'localinterwiki'] =
true;
536 if ( $interwikiMagic && in_array( $prefix, $extraLangPrefixes ) ) {
537 $val[
'extralanglink'] =
true;
539 $linktext = $this->
msg(
"interlanguage-link-$prefix" );
540 if ( !$linktext->isDisabled() ) {
541 $val[
'linktext'] = $linktext->text();
544 $sitename = $this->
msg(
"interlanguage-link-sitename-$prefix" );
545 if ( !$sitename->isDisabled() ) {
546 $val[
'sitename'] = $sitename->text();
551 $val[
'protorel'] = substr( $row[
'iw_url'], 0, 2 ) ==
'//';
552 if ( isset( $row[
'iw_wikiid'] ) && $row[
'iw_wikiid'] !==
'' ) {
553 $val[
'wikiid'] = $row[
'iw_wikiid'];
555 if ( isset( $row[
'iw_api'] ) && $row[
'iw_api'] !==
'' ) {
556 $val[
'api'] = $row[
'iw_api'];
562 ApiResult::setIndexedTagName( $data,
'iw' );
564 return $this->
getResult()->addValue(
'query', $property, $data );
569 $showHostnames = $this->
getConfig()->get( MainConfigNames::ShowHostnames );
571 if ( !$showHostnames ) {
572 $this->
dieWithError(
'apierror-siteinfo-includealldenied',
'includeAllDenied' );
575 $lags = $this->loadBalancer->getLagTimes();
576 foreach ( $lags as $i => $lag ) {
578 'host' => $this->loadBalancer->getServerName( $i ),
583 list( , $lag, $index ) = $this->loadBalancer->getMaxLag();
585 'host' => $showHostnames
586 ? $this->loadBalancer->getServerName( $index )
592 ApiResult::setIndexedTagName( $data,
'db' );
594 return $this->
getResult()->addValue(
'query', $property, $data );
608 $this->
getHookRunner()->onAPIQuerySiteInfoStatisticsInfo( $data );
610 return $this->
getResult()->addValue(
'query', $property, $data );
618 $allGroups = array_values( $this->userGroupManager->listAllGroups() );
619 foreach ( $config->get( MainConfigNames::GroupPermissions ) as $group => $permissions ) {
622 'rights' => array_keys( $permissions,
true ),
625 if ( $numberInGroup ) {
626 $autopromote = $config->get( MainConfigNames::Autopromote );
628 if ( $group ==
'user' ) {
631 } elseif ( $group !==
'*' && !isset( $autopromote[$group] ) ) {
637 'add' => $config->get( MainConfigNames::AddGroups ),
638 'remove' => $config->get( MainConfigNames::RemoveGroups ),
639 'add-self' => $config->get( MainConfigNames::GroupsAddToSelf ),
640 'remove-self' => $config->get( MainConfigNames::GroupsRemoveFromSelf )
643 foreach ( $groupArr as
$type => $rights ) {
644 if ( isset( $rights[$group] ) ) {
645 if ( $rights[$group] ===
true ) {
646 $groups = $allGroups;
648 $groups = array_intersect( $rights[$group], $allGroups );
651 $arr[
$type] = $groups;
652 ApiResult::setArrayType( $arr[
$type],
'BCarray' );
653 ApiResult::setIndexedTagName( $arr[
$type],
'group' );
658 ApiResult::setIndexedTagName( $arr[
'rights'],
'permission' );
662 ApiResult::setIndexedTagName( $data,
'group' );
664 return $result->addValue(
'query', $property, $data );
670 array_unique( $this->
getConfig()->
get( MainConfigNames::FileExtensions ) ) as
$ext
672 $data[] = [
'ext' =>
$ext ];
674 ApiResult::setIndexedTagName( $data,
'fe' );
676 return $this->
getResult()->addValue(
'query', $property, $data );
680 $baseDir = $this->
getConfig()->get( MainConfigNames::BaseDirectory );
681 $path =
"$baseDir/vendor/composer/installed.json";
682 if ( !file_exists(
$path ) ) {
688 foreach ( $installed->getInstalledDependencies() as $name => $info ) {
689 if ( strpos( $info[
'type'],
'mediawiki-' ) === 0 ) {
696 'version' => $info[
'version'],
699 ApiResult::setIndexedTagName( $data,
'library' );
701 return $this->
getResult()->addValue(
'query', $property, $data );
707 ExtensionRegistry::getInstance(),
710 foreach ( $credits as
$type => $extensions ) {
711 foreach ( $extensions as
$ext ) {
713 $ret[
'type'] =
$type;
714 if ( isset(
$ext[
'name'] ) ) {
715 $ret[
'name'] =
$ext[
'name'];
717 if ( isset(
$ext[
'namemsg'] ) ) {
718 $ret[
'namemsg'] =
$ext[
'namemsg'];
720 if ( isset(
$ext[
'description'] ) ) {
721 $ret[
'description'] =
$ext[
'description'];
723 if ( isset(
$ext[
'descriptionmsg'] ) ) {
725 if ( is_array(
$ext[
'descriptionmsg'] ) ) {
726 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'][0];
727 $ret[
'descriptionmsgparams'] = array_slice(
$ext[
'descriptionmsg'], 1 );
728 ApiResult::setIndexedTagName( $ret[
'descriptionmsgparams'],
'param' );
730 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'];
733 if ( isset(
$ext[
'author'] ) ) {
734 $ret[
'author'] = is_array(
$ext[
'author'] ) ?
735 implode(
', ',
$ext[
'author'] ) :
$ext[
'author'];
737 if ( isset(
$ext[
'url'] ) ) {
738 $ret[
'url'] =
$ext[
'url'];
740 if ( isset(
$ext[
'version'] ) ) {
741 $ret[
'version'] =
$ext[
'version'];
743 if ( isset(
$ext[
'path'] ) ) {
744 $extensionPath = dirname(
$ext[
'path'] );
745 $gitInfo =
new GitInfo( $extensionPath );
746 $vcsVersion = $gitInfo->getHeadSHA1();
747 if ( $vcsVersion !==
false ) {
748 $ret[
'vcs-system'] =
'git';
749 $ret[
'vcs-version'] = $vcsVersion;
750 $ret[
'vcs-url'] = $gitInfo->getHeadViewUrl();
751 $vcsDate = $gitInfo->getHeadCommitDate();
752 if ( $vcsDate !==
false ) {
753 $ret[
'vcs-date'] =
wfTimestamp( TS_ISO_8601, $vcsDate );
757 if ( ExtensionInfo::getLicenseFileNames( $extensionPath ) ) {
758 $ret[
'license-name'] =
$ext[
'license-name'] ??
'';
761 "License/{$ext['name']}"
765 if ( ExtensionInfo::getAuthorsFileName( $extensionPath ) ) {
768 "Credits/{$ext['name']}"
776 ApiResult::setIndexedTagName( $data,
'ext' );
778 return $this->
getResult()->addValue(
'query', $property, $data );
783 $rightsPage = $config->get( MainConfigNames::RightsPage );
785 if ( strlen( (
string)$rightsPage ) ) {
786 $title = Title::newFromText( $rightsPage );
790 $url = $config->get( MainConfigNames::RightsUrl );
792 $text = $config->get( MainConfigNames::RightsText );
793 if (
$title && !strlen( (
string)$text ) ) {
794 $text =
$title->getPrefixedText();
798 'url' => (string)$url,
799 'text' => (
string)$text,
802 return $this->
getResult()->addValue(
'query', $property, $data );
808 'types' => $config->get( MainConfigNames::RestrictionTypes ),
809 'levels' => $config->get( MainConfigNames::RestrictionLevels ),
810 'cascadinglevels' => $config->get( MainConfigNames::CascadingRestrictionLevels ),
811 'semiprotectedlevels' => $config->get( MainConfigNames::SemiprotectedRestrictionLevels ),
814 ApiResult::setArrayType( $data[
'types'],
'BCarray' );
815 ApiResult::setArrayType( $data[
'levels'],
'BCarray' );
816 ApiResult::setArrayType( $data[
'cascadinglevels'],
'BCarray' );
817 ApiResult::setArrayType( $data[
'semiprotectedlevels'],
'BCarray' );
819 ApiResult::setIndexedTagName( $data[
'types'],
'type' );
820 ApiResult::setIndexedTagName( $data[
'levels'],
'level' );
821 ApiResult::setIndexedTagName( $data[
'cascadinglevels'],
'level' );
822 ApiResult::setIndexedTagName( $data[
'semiprotectedlevels'],
'level' );
824 return $this->
getResult()->addValue(
'query', $property, $data );
829 $langCode = $params[
'inlanguagecode'] ??
'';
830 $langNames = $this->languageNameUtils->getLanguageNames( $langCode );
834 foreach ( $langNames as $code => $name ) {
837 'bcp47' => LanguageCode::bcp47( $code ),
839 ApiResult::setContentValue(
$lang,
'name', $name );
842 ApiResult::setIndexedTagName( $data,
'lang' );
844 return $this->
getResult()->addValue(
'query', $property, $data );
850 $langNames = LanguageConverter::$languagesWithVariants;
851 if ( $this->languageConverterFactory->isConversionDisabled() ) {
858 foreach ( $langNames as $langCode ) {
859 $lang = $this->languageFactory->getLanguage( $langCode );
860 $langConverter = $this->languageConverterFactory->getLanguageConverter(
$lang );
861 if ( !$langConverter->hasVariants() ) {
865 $data[$langCode] = [];
866 ApiResult::setIndexedTagName( $data[$langCode],
'variant' );
867 ApiResult::setArrayType( $data[$langCode],
'kvp',
'code' );
869 $variants = $langConverter->getVariants();
871 foreach ( $variants as $v ) {
872 $fallbacks = $langConverter->getVariantFallbacks( $v );
873 if ( !is_array( $fallbacks ) ) {
874 $fallbacks = [ $fallbacks ];
876 $data[$langCode][$v] = [
877 'fallbacks' => $fallbacks,
879 ApiResult::setIndexedTagName(
880 $data[$langCode][$v][
'fallbacks'],
'variant'
884 ApiResult::setIndexedTagName( $data,
'lang' );
885 ApiResult::setArrayType( $data,
'kvp',
'code' );
887 return $this->
getResult()->addValue(
'query', $property, $data );
892 $allowed = $this->skinFactory->getAllowedSkins();
894 $skinNames = $this->skinFactory->getInstalledSkins();
896 foreach ( $skinNames as $name => $displayName ) {
897 $msg = $this->
msg(
"skinname-{$name}" );
899 if ( $code && $this->languageNameUtils->isValidCode( $code ) ) {
900 $msg->inLanguage( $code );
902 $msg->inContentLanguage();
904 if ( $msg->exists() ) {
905 $displayName = $msg->text();
907 $skin = [
'code' => $name ];
908 ApiResult::setContentValue( $skin,
'name', $displayName );
909 if ( !isset( $allowed[$name] ) ) {
910 $skin[
'unusable'] =
true;
912 if ( $name === $default ) {
913 $skin[
'default'] =
true;
917 ApiResult::setIndexedTagName( $data,
'skin' );
919 return $this->
getResult()->addValue(
'query', $property, $data );
924 static function ( $item ) {
927 $this->parser->getTags()
929 ApiResult::setArrayType( $tags,
'BCarray' );
930 ApiResult::setIndexedTagName( $tags,
't' );
932 return $this->
getResult()->addValue(
'query', $property, $tags );
936 $hooks = $this->parser->getFunctionHooks();
937 ApiResult::setArrayType( $hooks,
'BCarray' );
938 ApiResult::setIndexedTagName( $hooks,
'h' );
940 return $this->
getResult()->addValue(
'query', $property, $hooks );
944 $variables = $this->magicWordFactory->getVariableIDs();
945 ApiResult::setArrayType( $variables,
'BCarray' );
946 ApiResult::setIndexedTagName( $variables,
'v' );
948 return $this->
getResult()->addValue(
'query', $property, $variables );
953 $protocols = array_values( $this->
getConfig()->
get( MainConfigNames::UrlProtocols ) );
954 ApiResult::setArrayType( $protocols,
'BCarray' );
955 ApiResult::setIndexedTagName( $protocols,
'p' );
957 return $this->
getResult()->addValue(
'query', $property, $protocols );
961 $options = $this->userOptionsLookup->getDefaultOptions();
962 $options[ApiResult::META_BC_BOOLS] = array_keys( $options );
963 return $this->
getResult()->addValue(
'query', $property, $options );
967 $config = $this->
getConfig()->get( MainConfigNames::UploadDialog );
968 return $this->
getResult()->addValue(
'query', $property, $config );
972 $hooks = $this->
getConfig()->get( MainConfigNames::Hooks );
977 foreach ( $myWgHooks as $name => $subscribers ) {
980 'subscribers' => array_map( [ SpecialVersion::class,
'arrayToString' ], $subscribers ),
983 ApiResult::setArrayType( $arr[
'subscribers'],
'array' );
984 ApiResult::setIndexedTagName( $arr[
'subscribers'],
's' );
988 ApiResult::setIndexedTagName( $data,
'hook' );
990 return $this->
getResult()->addValue(
'query', $property, $data );
996 count( $this->
getConfig()->
get( MainConfigNames::ExtraInterlanguageLinkPrefixes ) ) &&
997 $params[
'prop'] !==
null &&
998 in_array(
'interwikimap', $params[
'prop'] )
1000 return 'anon-public-user-private';
1009 ParamValidator::PARAM_DEFAULT =>
'general',
1010 ParamValidator::PARAM_ISMULTI =>
true,
1011 ParamValidator::PARAM_TYPE => [
1015 'specialpagealiases',
1040 ParamValidator::PARAM_TYPE => [
1045 'showalldb' =>
false,
1046 'numberingroup' =>
false,
1047 'inlanguagecode' =>
null,
1053 'action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics'
1054 =>
'apihelp-query+siteinfo-example-simple',
1055 'action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local'
1056 =>
'apihelp-query+siteinfo-example-interwiki',
1057 'action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb='
1058 =>
'apihelp-query+siteinfo-example-replag',
1063 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Siteinfo';
const MW_VERSION
The running version of MediaWiki.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getHookRunner()
Get an ApiHookRunner for running core API hooks.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
A query action to return meta information about the wiki site.
appendLanguageVariants( $property)
appendLanguages( $property)
appendInterwikiMap( $property, $filter)
appendGeneralInfo( $property)
appendRightsInfo( $property)
getExamplesMessages()
Returns usage examples for this module.
appendInstalledLibraries( $property)
appendVariables( $property)
__construct(ApiQuery $query, $moduleName, UserOptionsLookup $userOptionsLookup, UserGroupManager $userGroupManager, LanguageConverterFactory $languageConverterFactory, LanguageFactory $languageFactory, LanguageNameUtils $languageNameUtils, Language $contentLanguage, NamespaceInfo $namespaceInfo, InterwikiLookup $interwikiLookup, Parser $parser, MagicWordFactory $magicWordFactory, SpecialPageFactory $specialPageFactory, SkinFactory $skinFactory, ILoadBalancer $loadBalancer, ReadOnlyMode $readOnlyMode)
appendUserGroups( $property, $numberInGroup)
appendFileExtensions( $property)
appendNamespaces( $property)
appendDefaultOptions( $property)
appendMagicWords( $property)
getHelpUrls()
Return links to more detailed help pages about the module.
appendExtensions( $property)
getCacheMode( $params)
Get the cache mode for the data generated by this module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
appendRestrictions( $property)
appendExtensionTags( $property)
appendUploadDialog( $property)
appendProtocols( $property)
appendStatistics( $property)
appendSpecialPageAliases( $property)
appendDbReplLagInfo( $property, $includeAll)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
appendSubscribedHooks( $property)
appendFunctionHooks( $property)
appendNamespaceAliases( $property)
This is the main query class.
static getMinUploadChunkSize(Config $config)
Reads an installed.json file and provides accessors to get what is installed.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Base class for language-specific code.
A factory that stores information about MagicWords, and creates them on demand with caching.
A class containing constants representing the names of configuration variables.
Factory for handling the special page list and generating SpecialPage objects.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
A service class for fetching the wiki's current read-only mode.
static jobs()
Total number of jobs in the job queue.
static numberingroup( $group)
Find the number of users in a given user group.
Factory class to create Skin objects.
static normalizeKey( $key)
Normalize a skin preference value to a form that can be loaded.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static getGitHeadSha1( $dir)
static getCredits(ExtensionRegistry $reg, Config $conf)
static getGitCurrentBranch( $dir)
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang