32 parent::__construct(
$query, $moduleName,
'si' );
39 foreach (
$params[
'prop'] as $p ) {
47 case 'namespacealiases':
50 case 'specialpagealiases':
74 case 'fileextensions':
86 case 'languagevariants':
107 case 'defaultoptions':
131 $mainPage = Title::newMainPage();
132 $data[
'mainpage'] = $mainPage->getPrefixedText();
134 $data[
'sitename'] = $config->get(
'Sitename' );
140 $data[
'generator'] =
"MediaWiki {$config->get( 'Version' )}";
144 if ( defined(
'HHVM_VERSION' ) ) {
147 $data[
'dbtype'] = $config->get(
'DBtype' );
148 $data[
'dbversion'] = $this->
getDB()->getServerVersion();
151 $allowException =
true;
152 if ( !$config->get(
'AllowExternalImages' ) ) {
153 $data[
'imagewhitelistenabled'] = (
bool)$config->get(
'EnableImageWhitelist' );
154 $allowFrom = $config->get(
'AllowExternalImagesFrom' );
155 $allowException = !empty( $allowFrom );
157 if ( $allowException ) {
162 $data[
'langconversion'] = !$config->get(
'DisableLangConversion' );
163 $data[
'titleconversion'] = !$config->get(
'DisableTitleConversion' );
165 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
166 if ( $contLang->linkPrefixExtension() ) {
170 $data[
'linkprefix'] =
"/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu";
172 $data[
'linkprefixcharset'] =
'';
173 $data[
'linkprefix'] =
'';
176 $linktrail = $contLang->linkTrail();
177 $data[
'linktrail'] = $linktrail ?:
'';
179 $data[
'legaltitlechars'] = Title::legalChars();
180 $data[
'invalidusernamechars'] = $config->get(
'InvalidUsernameCharacters' );
182 $data[
'allunicodefixes'] = (
bool)$config->get(
'AllUnicodeFixes' );
183 $data[
'fixarabicunicode'] = (
bool)$config->get(
'FixArabicUnicode' );
184 $data[
'fixmalayalamunicode'] = (
bool)$config->get(
'FixMalayalamUnicode' );
190 $data[
'git-branch'] =
195 $data[
'case'] = $config->get(
'CapitalLinks' ) ?
'first-letter' :
'case-sensitive';
196 $data[
'lang'] = $config->get(
'LanguageCode' );
199 foreach ( $contLang->getFallbackLanguages() as
$code ) {
200 $fallbacks[] = [
'code' =>
$code ];
205 if ( $contLang->hasVariants() ) {
207 foreach ( $contLang->getVariants() as
$code ) {
210 'name' => $contLang->getVariantname(
$code ),
213 $data[
'variants'] = $variants;
217 $data[
'rtl'] = $contLang->isRTL();
218 $data[
'fallback8bitEncoding'] = $contLang->fallback8bitEncoding();
221 if (
$data[
'readonly'] ) {
224 $data[
'writeapi'] =
true;
226 $data[
'maxarticlesize'] = $config->get(
'MaxArticleSize' ) * 1024;
228 $tz = $config->get(
'Localtimezone' );
229 $offset = $config->get(
'LocalTZoffset' );
232 $data[
'articlepath'] = $config->get(
'ArticlePath' );
233 $data[
'scriptpath'] = $config->get(
'ScriptPath' );
234 $data[
'script'] = $config->get(
'Script' );
235 $data[
'variantarticlepath'] = $config->get(
'VariantArticlePath' );
237 $data[
'server'] = $config->get(
'Server' );
238 $data[
'servername'] = $config->get(
'ServerName' );
239 $data[
'wikiid'] = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
242 $data[
'misermode'] = (
bool)$config->get(
'MiserMode' );
246 $data[
'minuploadchunksize'] = (
int)$config->get(
'MinUploadChunkSize' );
248 $data[
'galleryoptions'] = $config->get(
'GalleryOptions' );
250 $data[
'thumblimits'] = $config->get(
'ThumbLimits' );
253 $data[
'imagelimits'] = [];
256 foreach ( $config->get(
'ImageLimits' ) as $k => $limit ) {
257 $data[
'imagelimits'][
$k] = [
'width' => $limit[0],
'height' => $limit[1] ];
260 $favicon = $config->get(
'Favicon' );
261 if ( !empty( $favicon ) ) {
267 $data[
'centralidlookupprovider'] = $config->get(
'CentralIdLookupProvider' );
268 $providerIds =
array_keys( $config->get(
'CentralIdLookupProviders' ) );
271 $data[
'interwikimagic'] = (
bool)$config->get(
'InterwikiMagic' );
272 $data[
'magiclinks'] = $config->get(
'EnableMagicLinks' );
274 $data[
'categorycollation'] = $config->get(
'CategoryCollation' );
276 Hooks::run(
'APIQuerySiteInfoGeneralInfo', [ $this, &
$data ] );
286 MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces()
291 'case' => MWNamespace::isCapitalized( $ns ) ?
'first-letter' :
'case-sensitive',
294 $canonical = MWNamespace::getCanonicalName( $ns );
296 $data[$ns][
'subpages'] = MWNamespace::hasSubpages( $ns );
299 $data[$ns][
'canonical'] =
strtr( $canonical,
'_',
' ' );
302 $data[$ns][
'content'] = MWNamespace::isContent( $ns );
303 $data[$ns][
'nonincludable'] = MWNamespace::isNonincludable( $ns );
305 $contentmodel = MWNamespace::getNamespaceContentModel( $ns );
306 if ( $contentmodel ) {
318 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
320 $contLang->getNamespaceAliases() );
323 foreach ( $aliases as $title => $ns ) {
344 $services = MediaWikiServices::getInstance();
345 $aliases =
$services->getContentLanguage()->getSpecialPageAliases();
346 foreach (
$services->getSpecialPageFactory()->getNames() as $specialpage ) {
347 if (
isset( $aliases[$specialpage] ) ) {
361 MediaWikiServices::getInstance()->getContentLanguage()->getMagicWords()
362 as $magicword => $aliases
365 $arr = [
'name' =>
$magicword,
'aliases' => $aliases ];
366 $arr[
'case-sensitive'] = (
bool)$caseSensitive;
386 $langCode =
$params[
'inlanguagecode'] ??
'';
387 $langNames = Language::fetchLanguageNames( $langCode );
389 $getPrefixes = MediaWikiServices::getInstance()->getInterwikiLookup()->getAllPrefixes( $local );
390 $extraLangPrefixes = $this->
getConfig()->get(
'ExtraInterlanguageLinkPrefixes' );
391 $localInterwikis = $this->
getConfig()->get(
'LocalInterwikis' );
394 foreach ( $getPrefixes as $row ) {
395 $prefix = $row[
'iw_prefix'];
397 $val[
'prefix'] = $prefix;
398 if (
isset( $row[
'iw_local'] ) && $row[
'iw_local'] ==
'1' ) {
399 $val[
'local'] =
true;
401 if (
isset( $row[
'iw_trans'] ) && $row[
'iw_trans'] ==
'1' ) {
402 $val[
'trans'] =
true;
405 if (
isset( $langNames[$prefix] ) ) {
406 $val[
'language'] = $langNames[$prefix];
408 if (
in_array( $prefix, $localInterwikis ) ) {
409 $val[
'localinterwiki'] =
true;
411 if (
in_array( $prefix, $extraLangPrefixes ) ) {
412 $val[
'extralanglink'] =
true;
414 $linktext =
wfMessage(
"interlanguage-link-$prefix" );
415 if ( !$linktext->isDisabled() ) {
416 $val[
'linktext'] = $linktext->text();
419 $sitename =
wfMessage(
"interlanguage-link-sitename-$prefix" );
420 if ( !$sitename->isDisabled() ) {
421 $val[
'sitename'] = $sitename->text();
426 $val[
'protorel'] =
substr( $row[
'iw_url'], 0, 2 ) ==
'//';
427 if (
isset( $row[
'iw_wikiid'] ) && $row[
'iw_wikiid'] !==
'' ) {
428 $val[
'wikiid'] = $row[
'iw_wikiid'];
430 if (
isset( $row[
'iw_api'] ) && $row[
'iw_api'] !==
'' ) {
431 $val[
'api'] = $row[
'iw_api'];
444 $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
445 $showHostnames = $this->
getConfig()->get(
'ShowHostnames' );
447 if ( !$showHostnames ) {
448 $this->
dieWithError(
'apierror-siteinfo-includealldenied',
'includeAllDenied' );
451 $lags = $lb->getLagTimes();
452 foreach ( $lags as $i => $lag ) {
454 'host' => $lb->getServerName( $i ),
459 list( , $lag, $index ) = $lb->getMaxLag();
461 'host' => $showHostnames
462 ? $lb->getServerName( $index )
484 Hooks::run(
'APIQuerySiteInfoStatisticsInfo', [ &
$data ] );
495 foreach ( $config->get(
'GroupPermissions' ) as $group => $permissions ) {
501 if ( $numberInGroup ) {
502 $autopromote = $config->get(
'Autopromote' );
504 if ( $group ==
'user' ) {
507 }
elseif ( $group !==
'*' && !
isset( $autopromote[$group] ) ) {
513 'add' => $config->get(
'AddGroups' ),
514 'remove' => $config->get(
'RemoveGroups' ),
515 'add-self' => $config->get(
'GroupsAddToSelf' ),
516 'remove-self' => $config->get(
'GroupsRemoveFromSelf' )
519 foreach ( $groupArr as
$type => $rights ) {
520 if (
isset( $rights[$group] ) ) {
521 if ( $rights[$group] ===
true ) {
527 $arr[
$type] = $groups;
555 $path =
"$IP/vendor/composer/installed.json";
562 foreach ( $installed->getInstalledDependencies() as $name => $info ) {
563 if (
strpos( $info[
'type'],
'mediawiki-' ) === 0 ) {
570 'version' => $info[
'version'],
580 foreach ( $this->
getConfig()->
get(
'ExtensionCredits' ) as
$type => $extensions ) {
581 foreach ( $extensions as
$ext ) {
591 $ret[
'description'] =
$ext[
'description'];
596 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'][0];
600 $ret[
'descriptionmsg'] =
$ext[
'descriptionmsg'];
605 implode(
', ',
$ext[
'author'] ) :
$ext[
'author'];
615 $gitInfo =
new GitInfo( $extensionPath );
616 $vcsVersion = $gitInfo->getHeadSHA1();
617 if ( $vcsVersion !==
false ) {
618 $ret[
'vcs-system'] =
'git';
620 $ret[
'vcs-url'] = $gitInfo->getHeadViewUrl();
621 $vcsDate = $gitInfo->getHeadCommitDate();
622 if ( $vcsDate !==
false ) {
628 $ret[
'license-name'] =
$ext[
'license-name'] ??
'';
629 $ret[
'license'] = SpecialPage::getTitleFor(
631 "License/{$ext['name']}"
636 $ret[
'credits'] = SpecialPage::getTitleFor(
638 "Credits/{$ext['name']}"
653 $rightsPage = $config->get(
'RightsPage' );
655 $title = Title::newFromText( $rightsPage );
659 $url = $config->get(
'RightsUrl' );
661 $text = $config->get(
'RightsText' );
662 if ( $title && !
strlen( $text ) ) {
663 $text = $title->getPrefixedText();
668 'text' => (
string)$text,
677 'types' => $config->get(
'RestrictionTypes' ),
678 'levels' => $config->get(
'RestrictionLevels' ),
679 'cascadinglevels' => $config->get(
'CascadingRestrictionLevels' ),
680 'semiprotectedlevels' => $config->get(
'SemiprotectedRestrictionLevels' ),
698 $langCode =
$params[
'inlanguagecode'] ??
'';
699 $langNames = Language::fetchLanguageNames( $langCode );
703 foreach ( $langNames as
$code => $name ) {
706 'bcp47' => LanguageCode::bcp47(
$code ),
719 $langNames = LanguageConverter::$languagesWithVariants;
720 if ( $this->
getConfig()->
get(
'DisableLangConversion' ) ) {
727 foreach ( $langNames as $langCode ) {
728 $lang = Language::factory( $langCode );
738 $variants =
$lang->getVariants();
740 foreach ( $variants as $v ) {
741 $fallbacks =
$lang->getConverter()->getVariantFallbacks( $v );
749 $data[$langCode][$v][
'fallbacks'],
'variant'
761 $allowed = Skin::getAllowedSkins();
762 $default = Skin::normalizeKey(
'default' );
763 foreach ( Skin::getSkinNames() as $name => $displayName ) {
764 $msg = $this->
msg(
"skinname-{$name}" );
766 if (
$code && Language::isValidCode(
$code ) ) {
767 $msg->inLanguage(
$code );
769 $msg->inContentLanguage();
771 if ( $msg->exists() ) {
772 $displayName = $msg->text();
774 $skin = [
'code' =>
$name ];
776 if ( !
isset( $allowed[$name] ) ) {
777 $skin[
'unusable'] =
true;
779 if ( $name === $default ) {
780 $skin[
'default'] =
true;
813 $variables = MediaWikiServices::getInstance()->getMagicWordFactory()->getVariableIDs();
836 $config = $this->
getConfig()->get(
'UploadDialog' );
841 $hooks = $this->
getConfig()->get(
'Hooks' );
846 foreach ( $myWgHooks as $name => $subscribers ) {
849 'subscribers' =>
array_map( [ SpecialVersion::class,
'arrayToString' ], $subscribers ),
865 count( $this->
getConfig()->
get(
'ExtraInterlanguageLinkPrefixes' ) ) &&
869 return 'anon-public-user-private';
884 'specialpagealiases',
914 'showalldb' =>
false,
915 'numberingroup' =>
false,
916 'inlanguagecode' =>
null,
922 'action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics'
923 =>
'apihelp-query+siteinfo-example-simple',
924 'action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local'
925 =>
'apihelp-query+siteinfo-example-interwiki',
926 'action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb='
927 =>
'apihelp-query+siteinfo-example-replag',
932 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Siteinfo';
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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.
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.
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,...
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()
A fake language variant converter.
static jobs()
Total number of jobs in the job queue.
static numberingroup( $group)
Find the number of users in a given user group.
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.
static getAllGroups()
Return the set of defined explicit groups.
static getDefaultOptions()
Combine the language default options with any site-specific options and add the default language vari...
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 code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $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
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 use $formDescriptor instead 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
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang