36 parent::__construct(
$query, $moduleName,
'si' );
43 foreach (
$params[
'prop'] as $p ) {
51 case 'namespacealiases':
54 case 'specialpagealiases':
61 $filteriw = isset(
$params[
'filteriw'] ) ?
$params[
'filteriw'] :
false;
79 case 'fileextensions':
91 case 'languagevariants':
100 case 'functionhooks':
112 case 'defaultoptions':
125 array_diff(
$params[
'prop'], $done ) ) );
138 $mainPage = Title::newMainPage();
139 $data[
'mainpage'] = $mainPage->getPrefixedText();
141 $data[
'sitename'] = $config->get(
'Sitename' );
147 $data[
'generator'] =
"MediaWiki {$config->get( 'Version' )}";
149 $data[
'phpversion'] = PHP_VERSION;
150 $data[
'phpsapi'] = PHP_SAPI;
151 if ( defined(
'HHVM_VERSION' ) ) {
152 $data[
'hhvmversion'] = HHVM_VERSION;
154 $data[
'dbtype'] = $config->get(
'DBtype' );
155 $data[
'dbversion'] = $this->
getDB()->getServerVersion();
158 $allowException =
true;
159 if ( !$config->get(
'AllowExternalImages' ) ) {
160 $data[
'imagewhitelistenabled'] = (bool)$config->get(
'EnableImageWhitelist' );
161 $allowFrom = $config->get(
'AllowExternalImagesFrom' );
162 $allowException = !empty( $allowFrom );
164 if ( $allowException ) {
165 $data[
'externalimages'] = (
array)$allowFrom;
169 $data[
'langconversion'] = !$config->get(
'DisableLangConversion' );
170 $data[
'titleconversion'] = !$config->get(
'DisableTitleConversion' );
176 $data[
'linkprefix'] =
"/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
178 $data[
'linkprefixcharset'] =
'';
179 $data[
'linkprefix'] =
'';
183 $data[
'linktrail'] = $linktrail ?:
'';
185 $data[
'legaltitlechars'] = Title::legalChars();
186 $data[
'invalidusernamechars'] = $config->get(
'InvalidUsernameCharacters' );
188 $data[
'allunicodefixes'] = (bool)$config->get(
'AllUnicodeFixes' );
189 $data[
'fixarabicunicode'] = (bool)$config->get(
'FixArabicUnicode' );
190 $data[
'fixmalayalamunicode'] = (bool)$config->get(
'FixMalayalamUnicode' );
195 $data[
'git-hash'] = $git;
196 $data[
'git-branch'] =
201 $data[
'case'] = $config->get(
'CapitalLinks' ) ?
'first-letter' :
'case-sensitive';
202 $data[
'lang'] = $config->get(
'LanguageCode' );
206 $fallbacks[] = [
'code' =>
$code ];
208 $data[
'fallback'] = $fallbacks;
219 $data[
'variants'] = $variants;
224 $data[
'fallback8bitEncoding'] =
$wgContLang->fallback8bitEncoding();
227 if ( $data[
'readonly'] ) {
230 $data[
'writeapi'] = (bool)$config->get(
'EnableWriteAPI' );
232 $data[
'maxarticlesize'] = $config->get(
'MaxArticleSize' ) * 1024;
234 $tz = $config->get(
'Localtimezone' );
235 $offset = $config->get(
'LocalTZoffset' );
236 if ( is_null( $tz ) ) {
239 } elseif ( is_null( $offset ) ) {
242 $data[
'timezone'] = $tz;
243 $data[
'timeoffset'] = intval( $offset );
244 $data[
'articlepath'] = $config->get(
'ArticlePath' );
245 $data[
'scriptpath'] = $config->get(
'ScriptPath' );
246 $data[
'script'] = $config->get(
'Script' );
247 $data[
'variantarticlepath'] = $config->get(
'VariantArticlePath' );
249 $data[
'server'] = $config->get(
'Server' );
250 $data[
'servername'] = $config->get(
'ServerName' );
252 $data[
'time'] =
wfTimestamp( TS_ISO_8601, time() );
254 $data[
'misermode'] = (bool)$config->get(
'MiserMode' );
258 $data[
'minuploadchunksize'] = (int)$config->get(
'MinUploadChunkSize' );
260 $data[
'galleryoptions'] = $config->get(
'GalleryOptions' );
262 $data[
'thumblimits'] = $config->get(
'ThumbLimits' );
265 $data[
'imagelimits'] = [];
268 foreach ( $config->get(
'ImageLimits' ) as $k => $limit ) {
269 $data[
'imagelimits'][$k] = [
'width' => $limit[0],
'height' => $limit[1] ];
272 $favicon = $config->get(
'Favicon' );
273 if ( !empty( $favicon ) ) {
279 $data[
'centralidlookupprovider'] = $config->get(
'CentralIdLookupProvider' );
280 $providerIds = array_keys( $config->get(
'CentralIdLookupProviders' ) );
281 $data[
'allcentralidlookupproviders'] = $providerIds;
283 $data[
'interwikimagic'] = (bool)$config->get(
'InterwikiMagic' );
284 $data[
'magiclinks'] = $config->get(
'EnableMagicLinks' );
286 Hooks::run(
'APIQuerySiteInfoGeneralInfo', [ $this, &$data ] );
296 foreach (
$wgContLang->getFormattedNamespaces() as $ns => $title ) {
298 'id' => intval( $ns ),
299 'case' => MWNamespace::isCapitalized( $ns ) ?
'first-letter' :
'case-sensitive',
302 $canonical = MWNamespace::getCanonicalName( $ns );
304 $data[$ns][
'subpages'] = MWNamespace::hasSubpages( $ns );
307 $data[$ns][
'canonical'] = strtr( $canonical,
'_',
' ' );
310 $data[$ns][
'content'] = MWNamespace::isContent( $ns );
311 $data[$ns][
'nonincludable'] = MWNamespace::isNonincludable( $ns );
313 $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
314 if ( $contentmodel ) {
315 $data[$ns][
'defaultcontentmodel'] = $contentmodel;
327 $aliases = array_merge( $this->
getConfig()->
get(
'NamespaceAliases' ),
328 $wgContLang->getNamespaceAliases() );
331 foreach ( $aliases as $title => $ns ) {
337 'id' => intval( $ns )
355 if ( isset( $aliases[$specialpage] ) ) {
356 $arr = [
'realname' => $specialpage,
'aliases' => $aliases[$specialpage] ];
369 foreach (
$wgContLang->getMagicWords() as $magicword => $aliases ) {
370 $caseSensitive = array_shift( $aliases );
371 $arr = [
'name' => $magicword,
'aliases' => $aliases ];
372 $arr[
'case-sensitive'] = (bool)$caseSensitive;
383 if ( $filter ===
'local' ) {
385 } elseif ( $filter ===
'!local' ) {
387 } elseif ( $filter ) {
392 $langCode = isset(
$params[
'inlanguagecode'] ) ?
$params[
'inlanguagecode'] :
'';
393 $langNames = Language::fetchLanguageNames( $langCode );
395 $getPrefixes = MediaWikiServices::getInstance()->getInterwikiLookup()->getAllPrefixes( $local );
396 $extraLangPrefixes = $this->
getConfig()->get(
'ExtraInterlanguageLinkPrefixes' );
397 $localInterwikis = $this->
getConfig()->get(
'LocalInterwikis' );
400 foreach ( $getPrefixes as $row ) {
401 $prefix = $row[
'iw_prefix'];
403 $val[
'prefix'] = $prefix;
404 if ( isset( $row[
'iw_local'] ) && $row[
'iw_local'] ==
'1' ) {
405 $val[
'local'] =
true;
407 if ( isset( $row[
'iw_trans'] ) && $row[
'iw_trans'] ==
'1' ) {
408 $val[
'trans'] =
true;
411 if ( isset( $langNames[$prefix] ) ) {
412 $val[
'language'] = $langNames[$prefix];
414 if ( in_array( $prefix, $localInterwikis ) ) {
415 $val[
'localinterwiki'] =
true;
417 if ( in_array( $prefix, $extraLangPrefixes ) ) {
418 $val[
'extralanglink'] =
true;
420 $linktext =
wfMessage(
"interlanguage-link-$prefix" );
421 if ( !$linktext->isDisabled() ) {
422 $val[
'linktext'] = $linktext->text();
425 $sitename =
wfMessage(
"interlanguage-link-sitename-$prefix" );
426 if ( !$sitename->isDisabled() ) {
427 $val[
'sitename'] = $sitename->text();
432 $val[
'protorel'] = substr( $row[
'iw_url'], 0, 2 ) ==
'//';
433 if ( isset( $row[
'iw_wikiid'] ) && $row[
'iw_wikiid'] !==
'' ) {
434 $val[
'wikiid'] = $row[
'iw_wikiid'];
436 if ( isset( $row[
'iw_api'] ) && $row[
'iw_api'] !==
'' ) {
437 $val[
'api'] = $row[
'iw_api'];
451 $showHostnames = $this->
getConfig()->get(
'ShowHostnames' );
453 if ( !$showHostnames ) {
454 $this->
dieWithError(
'apierror-siteinfo-includealldenied',
'includeAllDenied' );
457 $lags = $lb->getLagTimes();
458 foreach ( $lags as $i => $lag ) {
460 'host' => $lb->getServerName( $i ),
465 list( , $lag, $index ) = $lb->getMaxLag();
467 'host' => $showHostnames
468 ? $lb->getServerName( $index )
470 'lag' => intval( $lag )
490 Hooks::run(
'APIQuerySiteInfoStatisticsInfo', [ &$data ] );
500 $allGroups = array_values( User::getAllGroups() );
501 foreach ( $config->get(
'GroupPermissions' ) as $group => $permissions ) {
504 'rights' => array_keys( $permissions,
true ),
507 if ( $numberInGroup ) {
508 $autopromote = $config->get(
'Autopromote' );
510 if ( $group ==
'user' ) {
513 } elseif ( $group !==
'*' && !isset( $autopromote[$group] ) ) {
519 'add' => $config->get(
'AddGroups' ),
520 'remove' => $config->get(
'RemoveGroups' ),
521 'add-self' => $config->get(
'GroupsAddToSelf' ),
522 'remove-self' => $config->get(
'GroupsRemoveFromSelf' )
525 foreach ( $groupArr as
$type => $rights ) {
526 if ( isset( $rights[$group] ) ) {
527 if ( $rights[$group] ===
true ) {
528 $groups = $allGroups;
530 $groups = array_intersect( $rights[$group], $allGroups );
533 $arr[
$type] = $groups;
546 return $result->addValue(
'query',
$property, $data );
551 foreach ( array_unique( $this->
getConfig()->
get(
'FileExtensions' ) ) as
$ext ) {
552 $data[] = [
'ext' =>
$ext ];
561 $path =
"$IP/vendor/composer/installed.json";
562 if ( !file_exists( $path ) ) {
568 foreach ( $installed->getInstalledDependencies() as $name => $info ) {
569 if ( strpos( $info[
'type'],
'mediawiki-' ) === 0 ) {
576 'version' => $info[
'version'],
586 foreach ( $this->
getConfig()->
get(
'ExtensionCredits' ) as
$type => $extensions ) {
587 foreach ( $extensions as
$ext ) {
590 if ( isset(
$ext[
'name'] ) ) {
593 if ( isset(
$ext[
'namemsg'] ) ) {
596 if ( isset(
$ext[
'description'] ) ) {
597 $ret[
'description'] =
$ext[
'description'];
599 if ( isset(
$ext[
'descriptionmsg'] ) ) {
601 if ( is_array(
$ext[
'descriptionmsg'] ) ) {
602 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'][0];
603 $ret[
'descriptionmsgparams'] = array_slice(
$ext[
'descriptionmsg'], 1 );
606 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'];
609 if ( isset(
$ext[
'author'] ) ) {
610 $ret[
'author'] = is_array(
$ext[
'author'] ) ?
611 implode(
', ',
$ext[
'author'] ) :
$ext[
'author'];
613 if ( isset(
$ext[
'url'] ) ) {
616 if ( isset(
$ext[
'version'] ) ) {
619 if ( isset(
$ext[
'path'] ) ) {
620 $extensionPath = dirname(
$ext[
'path'] );
621 $gitInfo =
new GitInfo( $extensionPath );
622 $vcsVersion = $gitInfo->getHeadSHA1();
623 if ( $vcsVersion !==
false ) {
624 $ret[
'vcs-system'] =
'git';
625 $ret[
'vcs-version'] = $vcsVersion;
626 $ret[
'vcs-url'] = $gitInfo->getHeadViewUrl();
627 $vcsDate = $gitInfo->getHeadCommitDate();
628 if ( $vcsDate !==
false ) {
634 $ret[
'license-name'] = isset(
$ext[
'license-name'] ) ?
$ext[
'license-name'] :
'';
637 "License/{$ext['name']}"
644 "Credits/{$ext['name']}"
659 $rightsPage = $config->get(
'RightsPage' );
660 if ( is_string( $rightsPage ) ) {
661 $title = Title::newFromText( $rightsPage );
665 $url = $config->get(
'RightsUrl' );
667 $text = $config->get(
'RightsText' );
668 if ( !$text && $title ) {
669 $text = $title->getPrefixedText();
674 'text' => $text ?:
''
683 'types' => $config->get(
'RestrictionTypes' ),
684 'levels' => $config->get(
'RestrictionLevels' ),
685 'cascadinglevels' => $config->get(
'CascadingRestrictionLevels' ),
686 'semiprotectedlevels' => $config->get(
'SemiprotectedRestrictionLevels' ),
704 $langCode = isset(
$params[
'inlanguagecode'] ) ?
$params[
'inlanguagecode'] :
'';
705 $langNames = Language::fetchLanguageNames( $langCode );
709 foreach ( $langNames as
$code => $name ) {
723 if ( $this->
getConfig()->
get(
'DisableLangConversion' ) ) {
730 foreach ( $langNames as $langCode ) {
731 $lang = Language::factory( $langCode );
737 $data[$langCode] = [];
741 $variants =
$lang->getVariants();
743 foreach ( $variants as $v ) {
744 $fallbacks =
$lang->getConverter()->getVariantFallbacks( $v );
745 if ( !is_array( $fallbacks ) ) {
746 $fallbacks = [ $fallbacks ];
748 $data[$langCode][$v] = [
749 'fallbacks' => $fallbacks,
752 $data[$langCode][$v][
'fallbacks'],
'variant'
767 $msg = $this->
msg(
"skinname-{$name}" );
769 if (
$code && Language::isValidCode(
$code ) ) {
770 $msg->inLanguage(
$code );
772 $msg->inContentLanguage();
774 if ( $msg->exists() ) {
775 $displayName = $msg->text();
777 $skin = [
'code' =>
$name ];
779 if ( !isset( $allowed[$name] ) ) {
780 $skin[
'unusable'] =
true;
782 if ( $name === $default ) {
783 $skin[
'default'] =
true;
795 $tags = array_map( [ $this,
'formatParserTags' ],
$wgParser->getTags() );
822 $protocols = array_values( $this->
getConfig()->
get(
'UrlProtocols' ) );
830 $options = User::getDefaultOptions();
836 $config = $this->
getConfig()->get(
'UploadDialog' );
845 $hooks = $this->
getConfig()->get(
'Hooks' );
850 foreach ( $myWgHooks as $name => $subscribers ) {
853 'subscribers' => array_map( [
'SpecialVersion',
'arrayToString' ], $subscribers ),
869 count( $this->
getConfig()->
get(
'ExtraInterlanguageLinkPrefixes' ) ) &&
871 in_array(
'interwikimap',
$params[
'prop'] )
873 return 'anon-public-user-private';
888 'specialpagealiases',
918 'showalldb' =>
false,
919 'numberingroup' =>
false,
920 'inlanguagecode' =>
null,
926 'action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics'
927 =>
'apihelp-query+siteinfo-example-simple',
928 'action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local'
929 =>
'apihelp-query+siteinfo-example-interwiki',
930 'action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb='
931 =>
'apihelp-query+siteinfo-example-replag',
936 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Siteinfo';
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
wfGetLB( $wiki=false)
Get a load balancer object.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
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.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
getDB()
Get the Query database connection (read-only)
A query action to return meta information about the wiki site.
appendLanguageVariants( $property)
appendLanguages( $property)
appendInterwikiMap( $property, $filter)
appendGeneralInfo( $property)
__construct(ApiQuery $query, $moduleName)
appendRightsInfo( $property)
getExamplesMessages()
Returns usage examples for this module.
appendInstalledLibraries( $property)
appendVariables( $property)
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.
const META_TYPE
Key for the 'type' metadata item.
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static setContentValue(array &$arr, $name, $value, $flags=0)
Add an output value to the array by name and mark as META_CONTENT.
Reads an installed.json file and provides accessors to get what is installed.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getConfig()
Get the Config object.
A fake language variant converter.
static array $languagesWithVariants
languages supporting variants
static getVariableIDs()
Get an array of parser variable IDs.
static jobs()
Total number of jobs in the job queue.
static numberingroup( $group)
Find the number of users in a given user group.
static getAllowedSkins()
Fetch the list of user-selectable skins in regards to $wgSkipSkins.
static getSkinNames()
Fetch the set of available skins.
static normalizeKey( $key)
Normalize a skin preference value to a form that can be loaded.
static getNames()
Returns a list of canonical special page names.
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 getExtLicenseFileName( $extDir)
Obtains the full path of an extensions copying or license file if one exists.
static getExtAuthorsFileName( $extDir)
Obtains the full path of an extensions authors or credits file if one exists.
static getGitCurrentBranch( $dir)
static isEnabled()
Returns true if uploads are enabled.
static getMaxUploadSize( $forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace and then decline to actually register it & $namespaces
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Allows to change the fields on the form that will be generated $name
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
if(!isset( $args[0])) $lang