48 private $userOptionsLookup;
51 private $userGroupManager;
54 private $languageConverterFactory;
57 private $languageFactory;
60 private $languageNameUtils;
63 private $contentLanguage;
66 private $namespaceInfo;
69 private $interwikiLookup;
75 private $magicWordFactory;
78 private $specialPageFactory;
84 private $loadBalancer;
87 private $readOnlyMode;
125 parent::__construct( $query, $moduleName,
'si' );
126 $this->userOptionsLookup = $userOptionsLookup;
127 $this->userGroupManager = $userGroupManager;
128 $this->languageConverterFactory = $languageConverterFactory;
129 $this->languageFactory = $languageFactory;
130 $this->languageNameUtils = $languageNameUtils;
131 $this->contentLanguage = $contentLanguage;
132 $this->namespaceInfo = $namespaceInfo;
133 $this->interwikiLookup = $interwikiLookup;
134 $this->parser = $parser;
135 $this->magicWordFactory = $magicWordFactory;
136 $this->specialPageFactory = $specialPageFactory;
137 $this->skinFactory = $skinFactory;
138 $this->loadBalancer = $loadBalancer;
139 $this->readOnlyMode = $readOnlyMode;
145 foreach ( $params[
'prop'] as $p ) {
153 case 'namespacealiases':
156 case 'specialpagealiases':
180 case 'fileextensions':
192 case 'languagevariants':
198 case 'extensiontags':
201 case 'functionhooks':
213 case 'defaultoptions':
226 array_diff( $params[
'prop'], $done ) ) );
237 $mainPage = Title::newMainPage();
238 $data[
'mainpage'] = $mainPage->getPrefixedText();
240 $data[
'sitename'] = $config->get( MainConfigNames::Sitename );
241 $data[
'mainpageisdomainroot'] = (bool)$config->get( MainConfigNames::MainPageIsDomainRoot );
245 $logo = SkinModule::getAvailableLogos( $config );
248 $data[
'generator'] =
'MediaWiki ' .
MW_VERSION;
250 $data[
'phpversion'] = PHP_VERSION;
251 $data[
'phpsapi'] = PHP_SAPI;
252 $data[
'dbtype'] = $config->get( MainConfigNames::DBtype );
253 $data[
'dbversion'] = $this->
getDB()->getServerVersion();
256 $allowException =
true;
257 if ( !$config->get( MainConfigNames::AllowExternalImages ) ) {
258 $data[
'imagewhitelistenabled'] =
259 (bool)$config->get( MainConfigNames::EnableImageWhitelist );
260 $allowFrom = $config->get( MainConfigNames::AllowExternalImagesFrom );
261 $allowException = !empty( $allowFrom );
263 if ( $allowException ) {
264 $data[
'externalimages'] = (array)$allowFrom;
265 ApiResult::setIndexedTagName( $data[
'externalimages'],
'prefix' );
268 $data[
'langconversion'] = !$this->languageConverterFactory->isConversionDisabled();
269 $data[
'linkconversion'] = !$this->languageConverterFactory->isLinkConversionDisabled();
271 $data[
'titleconversion'] = $data[
'linkconversion'];
273 $contLangConverter = $this->languageConverterFactory->getLanguageConverter( $this->contentLanguage );
274 if ( $this->contentLanguage->linkPrefixExtension() ) {
278 $data[
'linkprefix'] =
"/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
280 $data[
'linkprefixcharset'] =
'';
281 $data[
'linkprefix'] =
'';
284 $linktrail = $this->contentLanguage->linkTrail();
285 $data[
'linktrail'] = $linktrail ?:
'';
287 $data[
'legaltitlechars'] = Title::legalChars();
288 $data[
'invalidusernamechars'] = $config->get( MainConfigNames::InvalidUsernameCharacters );
290 $data[
'allunicodefixes'] = (bool)$config->get( MainConfigNames::AllUnicodeFixes );
291 $data[
'fixarabicunicode'] =
true;
292 $data[
'fixmalayalamunicode'] =
true;
294 $baseDir = $this->
getConfig()->get( MainConfigNames::BaseDirectory );
297 $data[
'git-hash'] = $git;
298 $data[
'git-branch'] =
304 $config->get( MainConfigNames::CapitalLinks ) ?
'first-letter' :
'case-sensitive';
305 $data[
'lang'] = $config->get( MainConfigNames::LanguageCode );
308 foreach ( $this->contentLanguage->getFallbackLanguages() as $code ) {
309 $fallbacks[] = [
'code' => $code ];
311 $data[
'fallback'] = $fallbacks;
312 ApiResult::setIndexedTagName( $data[
'fallback'],
'lang' );
314 if ( $contLangConverter->hasVariants() ) {
316 foreach ( $contLangConverter->getVariants() as $code ) {
319 'name' => $this->contentLanguage->getVariantname( $code ),
322 $data[
'variants'] = $variants;
323 ApiResult::setIndexedTagName( $data[
'variants'],
'lang' );
326 $data[
'rtl'] = $this->contentLanguage->isRTL();
327 $data[
'fallback8bitEncoding'] = $this->contentLanguage->fallback8bitEncoding();
329 $data[
'readonly'] = $this->readOnlyMode->isReadOnly();
330 if ( $data[
'readonly'] ) {
331 $data[
'readonlyreason'] = $this->readOnlyMode->getReason();
333 $data[
'writeapi'] =
true;
335 $data[
'maxarticlesize'] = $config->get( MainConfigNames::MaxArticleSize ) * 1024;
337 $tz = $config->get( MainConfigNames::Localtimezone );
338 $offset = $config->get( MainConfigNames::LocalTZoffset );
339 $data[
'timezone'] = $tz;
340 $data[
'timeoffset'] = (int)$offset;
341 $data[
'articlepath'] = $config->get( MainConfigNames::ArticlePath );
342 $data[
'scriptpath'] = $config->get( MainConfigNames::ScriptPath );
343 $data[
'script'] = $config->get( MainConfigNames::Script );
344 $data[
'variantarticlepath'] = $config->get( MainConfigNames::VariantArticlePath );
345 $data[ApiResult::META_BC_BOOLS][] =
'variantarticlepath';
346 $data[
'server'] = $config->get( MainConfigNames::Server );
347 $data[
'servername'] = $config->get( MainConfigNames::ServerName );
348 $data[
'wikiid'] = WikiMap::getCurrentWikiId();
349 $data[
'time'] =
wfTimestamp( TS_ISO_8601, time() );
351 $data[
'misermode'] = (bool)$config->get( MainConfigNames::MiserMode );
353 $data[
'uploadsenabled'] = UploadBase::isEnabled();
354 $data[
'maxuploadsize'] = UploadBase::getMaxUploadSize();
357 $data[
'galleryoptions'] = $config->get( MainConfigNames::GalleryOptions );
359 $data[
'thumblimits'] = $config->get( MainConfigNames::ThumbLimits );
360 ApiResult::setArrayType( $data[
'thumblimits'],
'BCassoc' );
361 ApiResult::setIndexedTagName( $data[
'thumblimits'],
'limit' );
362 $data[
'imagelimits'] = [];
363 ApiResult::setArrayType( $data[
'imagelimits'],
'BCassoc' );
364 ApiResult::setIndexedTagName( $data[
'imagelimits'],
'limit' );
365 foreach ( $config->get( MainConfigNames::ImageLimits ) as $k => $limit ) {
366 $data[
'imagelimits'][$k] = [
'width' => $limit[0],
'height' => $limit[1] ];
369 $favicon = $config->get( MainConfigNames::Favicon );
375 $data[
'centralidlookupprovider'] =
376 $config->get( MainConfigNames::CentralIdLookupProvider );
377 $providerIds = array_keys( $config->get( MainConfigNames::CentralIdLookupProviders ) );
378 $data[
'allcentralidlookupproviders'] = $providerIds;
380 $data[
'interwikimagic'] = (bool)$config->get( MainConfigNames::InterwikiMagic );
381 $data[
'magiclinks'] = $config->get( MainConfigNames::EnableMagicLinks );
383 $data[
'categorycollation'] = $config->get( MainConfigNames::CategoryCollation );
385 $data[
'nofollowlinks'] = $config->get( MainConfigNames::NoFollowLinks );
386 $data[
'nofollownsexceptions'] = $config->get( MainConfigNames::NoFollowNsExceptions );
387 $data[
'nofollowdomainexceptions'] = $config->get( MainConfigNames::NoFollowDomainExceptions );
388 $data[
'externallinktarget'] = $config->get( MainConfigNames::ExternalLinkTarget );
390 $this->
getHookRunner()->onAPIQuerySiteInfoGeneralInfo( $this, $data );
392 return $this->
getResult()->addValue(
'query', $property, $data );
396 $nsProtection = $this->
getConfig()->get( MainConfigNames::NamespaceProtection );
399 ApiResult::META_TYPE =>
'assoc',
402 $this->contentLanguage->getFormattedNamespaces()
407 'case' => $this->namespaceInfo->isCapitalized( $ns ) ?
'first-letter' :
'case-sensitive',
409 ApiResult::setContentValue( $data[$ns],
'name',
$title );
410 $canonical = $this->namespaceInfo->getCanonicalName( $ns );
412 $data[$ns][
'subpages'] = $this->namespaceInfo->hasSubpages( $ns );
415 $data[$ns][
'canonical'] = strtr( $canonical,
'_',
' ' );
418 $data[$ns][
'content'] = $this->namespaceInfo->isContent( $ns );
419 $data[$ns][
'nonincludable'] = $this->namespaceInfo->isNonincludable( $ns );
421 if ( isset( $nsProtection[$ns] ) ) {
422 if ( is_array( $nsProtection[$ns] ) ) {
423 $specificNs = implode(
"|", array_filter( $nsProtection[$ns] ) );
424 } elseif ( $nsProtection[$ns] !==
'' ) {
425 $specificNs = $nsProtection[$ns];
427 if ( isset( $specificNs ) && $specificNs !==
'' ) {
428 $data[$ns][
'namespaceprotection'] = $specificNs;
432 $contentmodel = $this->namespaceInfo->getNamespaceContentModel( $ns );
433 if ( $contentmodel ) {
434 $data[$ns][
'defaultcontentmodel'] = $contentmodel;
438 ApiResult::setArrayType( $data,
'assoc' );
439 ApiResult::setIndexedTagName( $data,
'ns' );
441 return $this->
getResult()->addValue(
'query', $property, $data );
445 $aliases = $this->contentLanguage->getNamespaceAliases();
446 $namespaces = $this->contentLanguage->getNamespaces();
448 foreach ( $aliases as
$title => $ns ) {
449 if ( $namespaces[$ns] ==
$title ) {
456 ApiResult::setContentValue( $item,
'alias', strtr(
$title,
'_',
' ' ) );
462 ApiResult::setIndexedTagName( $data,
'ns' );
464 return $this->
getResult()->addValue(
'query', $property, $data );
469 $aliases = $this->contentLanguage->getSpecialPageAliases();
470 foreach ( $this->specialPageFactory->getNames() as $specialpage ) {
471 if ( isset( $aliases[$specialpage] ) ) {
472 $arr = [
'realname' => $specialpage,
'aliases' => $aliases[$specialpage] ];
473 ApiResult::setIndexedTagName( $arr[
'aliases'],
'alias' );
477 ApiResult::setIndexedTagName( $data,
'specialpage' );
479 return $this->
getResult()->addValue(
'query', $property, $data );
485 $this->contentLanguage->getMagicWords()
486 as $magicword => $aliases
488 $caseSensitive = array_shift( $aliases );
489 $arr = [
'name' => $magicword,
'aliases' => $aliases ];
490 $arr[
'case-sensitive'] = (bool)$caseSensitive;
491 ApiResult::setIndexedTagName( $arr[
'aliases'],
'alias' );
494 ApiResult::setIndexedTagName( $data,
'magicword' );
496 return $this->
getResult()->addValue(
'query', $property, $data );
500 if ( $filter ===
'local' ) {
502 } elseif ( $filter ===
'!local' ) {
510 $langCode = $params[
'inlanguagecode'] ??
'';
511 $interwikiMagic = $this->
getConfig()->get( MainConfigNames::InterwikiMagic );
513 if ( $interwikiMagic ) {
514 $langNames = $this->languageNameUtils->getLanguageNames( $langCode );
517 $getPrefixes = $this->interwikiLookup->getAllPrefixes( $local );
518 $extraLangPrefixes = $this->
getConfig()->get( MainConfigNames::ExtraInterlanguageLinkPrefixes );
519 $extraLangCodeMap = $this->
getConfig()->get( MainConfigNames::InterlanguageLinkCodeMap );
520 $localInterwikis = $this->
getConfig()->get( MainConfigNames::LocalInterwikis );
523 foreach ( $getPrefixes as $row ) {
524 $prefix = $row[
'iw_prefix'];
526 $val[
'prefix'] = $prefix;
527 if ( isset( $row[
'iw_local'] ) && $row[
'iw_local'] ==
'1' ) {
528 $val[
'local'] =
true;
530 if ( isset( $row[
'iw_trans'] ) && $row[
'iw_trans'] ==
'1' ) {
531 $val[
'trans'] =
true;
534 if ( $interwikiMagic && isset( $langNames[$prefix] ) ) {
535 $val[
'language'] = $langNames[$prefix];
536 $standard = LanguageCode::replaceDeprecatedCodes( $prefix );
537 if ( $standard !== $prefix ) {
538 # Note that even if this code is deprecated, it should
539 # only be remapped if extralanglink (set below) is false.
540 $val[
'deprecated'] = $standard;
542 $val[
'bcp47'] = LanguageCode::bcp47( $standard );
544 if ( in_array( $prefix, $localInterwikis ) ) {
545 $val[
'localinterwiki'] =
true;
547 if ( $interwikiMagic && in_array( $prefix, $extraLangPrefixes ) ) {
548 $val[
'extralanglink'] =
true;
549 $val[
'code'] = $extraLangCodeMap[$prefix] ?? $prefix;
550 $val[
'bcp47'] = LanguageCode::bcp47( $val[
'code'] );
552 $linktext = $this->
msg(
"interlanguage-link-$prefix" );
553 if ( !$linktext->isDisabled() ) {
554 $val[
'linktext'] = $linktext->text();
557 $sitename = $this->
msg(
"interlanguage-link-sitename-$prefix" );
558 if ( !$sitename->isDisabled() ) {
559 $val[
'sitename'] = $sitename->text();
564 $val[
'protorel'] = str_starts_with( $row[
'iw_url'],
'//' );
565 if ( isset( $row[
'iw_wikiid'] ) && $row[
'iw_wikiid'] !==
'' ) {
566 $val[
'wikiid'] = $row[
'iw_wikiid'];
568 if ( isset( $row[
'iw_api'] ) && $row[
'iw_api'] !==
'' ) {
569 $val[
'api'] = $row[
'iw_api'];
575 ApiResult::setIndexedTagName( $data,
'iw' );
577 return $this->
getResult()->addValue(
'query', $property, $data );
582 $showHostnames = $this->
getConfig()->get( MainConfigNames::ShowHostnames );
584 if ( !$showHostnames ) {
585 $this->
dieWithError(
'apierror-siteinfo-includealldenied',
'includeAllDenied' );
588 $lags = $this->loadBalancer->getLagTimes();
589 foreach ( $lags as $i => $lag ) {
591 'host' => $this->loadBalancer->getServerName( $i ),
596 [ , $lag, $index ] = $this->loadBalancer->getMaxLag();
598 'host' => $showHostnames
599 ? $this->loadBalancer->getServerName( $index )
605 ApiResult::setIndexedTagName( $data,
'db' );
607 return $this->
getResult()->addValue(
'query', $property, $data );
621 $this->
getHookRunner()->onAPIQuerySiteInfoStatisticsInfo( $data );
623 return $this->
getResult()->addValue(
'query', $property, $data );
631 $allGroups = array_values( $this->userGroupManager->listAllGroups() );
632 foreach ( $config->get( MainConfigNames::GroupPermissions ) as $group => $permissions ) {
635 'rights' => array_keys( $permissions,
true ),
638 if ( $numberInGroup ) {
639 $autopromote = $config->get( MainConfigNames::Autopromote );
641 if ( $group ==
'user' ) {
644 } elseif ( $group !==
'*' && !isset( $autopromote[$group] ) ) {
650 'add' => $config->get( MainConfigNames::AddGroups ),
651 'remove' => $config->get( MainConfigNames::RemoveGroups ),
652 'add-self' => $config->get( MainConfigNames::GroupsAddToSelf ),
653 'remove-self' => $config->get( MainConfigNames::GroupsRemoveFromSelf )
656 foreach ( $groupArr as
$type => $rights ) {
657 if ( isset( $rights[$group] ) ) {
658 if ( $rights[$group] ===
true ) {
659 $groups = $allGroups;
661 $groups = array_intersect( $rights[$group], $allGroups );
664 $arr[
$type] = $groups;
665 ApiResult::setArrayType( $arr[
$type],
'BCarray' );
666 ApiResult::setIndexedTagName( $arr[
$type],
'group' );
671 ApiResult::setIndexedTagName( $arr[
'rights'],
'permission' );
675 ApiResult::setIndexedTagName( $data,
'group' );
677 return $result->addValue(
'query', $property, $data );
683 array_unique( $this->
getConfig()->
get( MainConfigNames::FileExtensions ) ) as
$ext
685 $data[] = [
'ext' =>
$ext ];
687 ApiResult::setIndexedTagName( $data,
'fe' );
689 return $this->
getResult()->addValue(
'query', $property, $data );
693 $baseDir = $this->
getConfig()->get( MainConfigNames::BaseDirectory );
694 $path =
"$baseDir/vendor/composer/installed.json";
695 if ( !file_exists(
$path ) ) {
701 foreach ( $installed->getInstalledDependencies() as $name => $info ) {
702 if ( str_starts_with( $info[
'type'],
'mediawiki-' ) ) {
709 'version' => $info[
'version'],
712 ApiResult::setIndexedTagName( $data,
'library' );
714 return $this->
getResult()->addValue(
'query', $property, $data );
720 ExtensionRegistry::getInstance(),
723 foreach ( $credits as
$type => $extensions ) {
724 foreach ( $extensions as
$ext ) {
726 $ret[
'type'] =
$type;
727 if ( isset(
$ext[
'name'] ) ) {
728 $ret[
'name'] =
$ext[
'name'];
730 if ( isset(
$ext[
'namemsg'] ) ) {
731 $ret[
'namemsg'] =
$ext[
'namemsg'];
733 if ( isset(
$ext[
'description'] ) ) {
734 $ret[
'description'] =
$ext[
'description'];
736 if ( isset(
$ext[
'descriptionmsg'] ) ) {
738 if ( is_array(
$ext[
'descriptionmsg'] ) ) {
739 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'][0];
740 $ret[
'descriptionmsgparams'] = array_slice(
$ext[
'descriptionmsg'], 1 );
741 ApiResult::setIndexedTagName( $ret[
'descriptionmsgparams'],
'param' );
743 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'];
746 if ( isset(
$ext[
'author'] ) ) {
747 $ret[
'author'] = is_array(
$ext[
'author'] ) ?
748 implode(
', ',
$ext[
'author'] ) :
$ext[
'author'];
750 if ( isset(
$ext[
'url'] ) ) {
751 $ret[
'url'] =
$ext[
'url'];
753 if ( isset(
$ext[
'version'] ) ) {
754 $ret[
'version'] =
$ext[
'version'];
756 if ( isset(
$ext[
'path'] ) ) {
757 $extensionPath = dirname(
$ext[
'path'] );
758 $gitInfo =
new GitInfo( $extensionPath );
759 $vcsVersion = $gitInfo->getHeadSHA1();
760 if ( $vcsVersion !==
false ) {
761 $ret[
'vcs-system'] =
'git';
762 $ret[
'vcs-version'] = $vcsVersion;
763 $ret[
'vcs-url'] = $gitInfo->getHeadViewUrl();
764 $vcsDate = $gitInfo->getHeadCommitDate();
765 if ( $vcsDate !==
false ) {
766 $ret[
'vcs-date'] =
wfTimestamp( TS_ISO_8601, $vcsDate );
770 if ( ExtensionInfo::getLicenseFileNames( $extensionPath ) ) {
771 $ret[
'license-name'] =
$ext[
'license-name'] ??
'';
774 "License/{$ext['name']}"
778 if ( ExtensionInfo::getAuthorsFileName( $extensionPath ) ) {
781 "Credits/{$ext['name']}"
789 ApiResult::setIndexedTagName( $data,
'ext' );
791 return $this->
getResult()->addValue(
'query', $property, $data );
796 $rightsPage = $config->get( MainConfigNames::RightsPage );
798 if ( strlen( (
string)$rightsPage ) ) {
799 $title = Title::newFromText( $rightsPage );
803 $url = $config->get( MainConfigNames::RightsUrl );
805 $text = $config->get( MainConfigNames::RightsText );
806 if (
$title && !strlen( (
string)$text ) ) {
807 $text =
$title->getPrefixedText();
811 'url' => (string)$url,
812 'text' => (
string)$text,
815 return $this->
getResult()->addValue(
'query', $property, $data );
821 'types' => $config->get( MainConfigNames::RestrictionTypes ),
822 'levels' => $config->get( MainConfigNames::RestrictionLevels ),
823 'cascadinglevels' => $config->get( MainConfigNames::CascadingRestrictionLevels ),
824 'semiprotectedlevels' => $config->get( MainConfigNames::SemiprotectedRestrictionLevels ),
827 ApiResult::setArrayType( $data[
'types'],
'BCarray' );
828 ApiResult::setArrayType( $data[
'levels'],
'BCarray' );
829 ApiResult::setArrayType( $data[
'cascadinglevels'],
'BCarray' );
830 ApiResult::setArrayType( $data[
'semiprotectedlevels'],
'BCarray' );
832 ApiResult::setIndexedTagName( $data[
'types'],
'type' );
833 ApiResult::setIndexedTagName( $data[
'levels'],
'level' );
834 ApiResult::setIndexedTagName( $data[
'cascadinglevels'],
'level' );
835 ApiResult::setIndexedTagName( $data[
'semiprotectedlevels'],
'level' );
837 return $this->
getResult()->addValue(
'query', $property, $data );
842 $langCode = $params[
'inlanguagecode'] ??
'';
843 $langNames = $this->languageNameUtils->getLanguageNames( $langCode );
847 foreach ( $langNames as $code => $name ) {
850 'bcp47' => LanguageCode::bcp47( $code ),
852 ApiResult::setContentValue(
$lang,
'name', $name );
855 ApiResult::setIndexedTagName( $data,
'lang' );
857 return $this->
getResult()->addValue(
'query', $property, $data );
863 $langNames = LanguageConverter::$languagesWithVariants;
864 if ( $this->languageConverterFactory->isConversionDisabled() ) {
871 foreach ( $langNames as $langCode ) {
872 $lang = $this->languageFactory->getLanguage( $langCode );
873 $langConverter = $this->languageConverterFactory->getLanguageConverter(
$lang );
874 if ( !$langConverter->hasVariants() ) {
878 $data[$langCode] = [];
879 ApiResult::setIndexedTagName( $data[$langCode],
'variant' );
880 ApiResult::setArrayType( $data[$langCode],
'kvp',
'code' );
882 $variants = $langConverter->getVariants();
884 foreach ( $variants as $v ) {
885 $fallbacks = $langConverter->getVariantFallbacks( $v );
886 if ( !is_array( $fallbacks ) ) {
887 $fallbacks = [ $fallbacks ];
889 $data[$langCode][$v] = [
890 'fallbacks' => $fallbacks,
892 ApiResult::setIndexedTagName(
893 $data[$langCode][$v][
'fallbacks'],
'variant'
897 ApiResult::setIndexedTagName( $data,
'lang' );
898 ApiResult::setArrayType( $data,
'kvp',
'code' );
900 return $this->
getResult()->addValue(
'query', $property, $data );
905 $allowed = $this->skinFactory->getAllowedSkins();
907 $skinNames = $this->skinFactory->getInstalledSkins();
909 foreach ( $skinNames as $name => $displayName ) {
910 $msg = $this->
msg(
"skinname-{$name}" );
912 if ( $code && $this->languageNameUtils->isValidCode( $code ) ) {
913 $msg->inLanguage( $code );
915 $msg->inContentLanguage();
917 if ( $msg->exists() ) {
918 $displayName = $msg->text();
920 $skin = [
'code' => $name ];
921 ApiResult::setContentValue( $skin,
'name', $displayName );
922 if ( !isset( $allowed[$name] ) ) {
923 $skin[
'unusable'] =
true;
925 if ( $name === $default ) {
926 $skin[
'default'] =
true;
930 ApiResult::setIndexedTagName( $data,
'skin' );
932 return $this->
getResult()->addValue(
'query', $property, $data );
937 static function ( $item ) {
940 $this->parser->getTags()
942 ApiResult::setArrayType( $tags,
'BCarray' );
943 ApiResult::setIndexedTagName( $tags,
't' );
945 return $this->
getResult()->addValue(
'query', $property, $tags );
949 $hooks = $this->parser->getFunctionHooks();
950 ApiResult::setArrayType( $hooks,
'BCarray' );
951 ApiResult::setIndexedTagName( $hooks,
'h' );
953 return $this->
getResult()->addValue(
'query', $property, $hooks );
957 $variables = $this->magicWordFactory->getVariableIDs();
958 ApiResult::setArrayType( $variables,
'BCarray' );
959 ApiResult::setIndexedTagName( $variables,
'v' );
961 return $this->
getResult()->addValue(
'query', $property, $variables );
966 $protocols = array_values( $this->
getConfig()->
get( MainConfigNames::UrlProtocols ) );
967 ApiResult::setArrayType( $protocols,
'BCarray' );
968 ApiResult::setIndexedTagName( $protocols,
'p' );
970 return $this->
getResult()->addValue(
'query', $property, $protocols );
974 $options = $this->userOptionsLookup->getDefaultOptions();
975 $options[ApiResult::META_BC_BOOLS] = array_keys( $options );
976 return $this->
getResult()->addValue(
'query', $property, $options );
980 $config = $this->
getConfig()->get( MainConfigNames::UploadDialog );
981 return $this->
getResult()->addValue(
'query', $property, $config );
985 $hookContainer = MediaWikiServices::getInstance()->getHookContainer();
986 $hookNames = $hookContainer->getHookNames();
990 foreach ( $hookNames as $name ) {
991 $subscribers = $hookContainer->getLegacyHandlers( $name );
995 'subscribers' => array_map( [ SpecialVersion::class,
'arrayToString' ], $subscribers ),
998 ApiResult::setArrayType( $arr[
'subscribers'],
'array' );
999 ApiResult::setIndexedTagName( $arr[
'subscribers'],
's' );
1003 ApiResult::setIndexedTagName( $data,
'hook' );
1005 return $this->
getResult()->addValue(
'query', $property, $data );
1011 count( $this->
getConfig()->
get( MainConfigNames::ExtraInterlanguageLinkPrefixes ) ) &&
1012 $params[
'prop'] !==
null &&
1013 in_array(
'interwikimap', $params[
'prop'] )
1015 return 'anon-public-user-private';
1024 ParamValidator::PARAM_DEFAULT =>
'general',
1025 ParamValidator::PARAM_ISMULTI =>
true,
1026 ParamValidator::PARAM_TYPE => [
1030 'specialpagealiases',
1055 ParamValidator::PARAM_TYPE => [
1060 'showalldb' =>
false,
1061 'numberingroup' =>
false,
1062 'inlanguagecode' =>
null,
1068 'action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics'
1069 =>
'apihelp-query+siteinfo-example-simple',
1070 'action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local'
1071 =>
'apihelp-query+siteinfo-example-interwiki',
1072 'action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb='
1073 =>
'apihelp-query+siteinfo-example-replag',
1078 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, or 'string' with PARAM_ISMULTI,...
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 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