23use HtmlFormatter\HtmlFormatter;
43 $context->setSkin( SkinFactory::getDefaultInstance()->makeSkin(
'apioutput' ) );
45 $context->setTitle( SpecialPage::getTitleFor(
'ApiHelp' ) );
47 $out->setRobotPolicy(
'noindex,nofollow' );
48 $out->setCopyrightUrl(
'https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright' );
56 $html = ob_get_clean();
61 'mime' =>
'text/html',
62 'filename' =>
'api-help.html',
100 $out->addModuleStyles( [
105 $out->addModuleStyles(
'mediawiki.toc.styles' );
109 $services = MediaWikiServices::getInstance();
117 if ( $cacheHelpTimeout > 0 ) {
122 $cached =
$cache->get( $cacheKey );
124 $out->addHTML( $cached );
129 if (
$out->getHTML() !==
'' ) {
135 $options[
'recursivesubmodules'] = !empty(
$options[
'recursivesubmodules'] );
139 if ( empty(
$options[
'nolead'] ) ) {
141 if ( !$msg->isDisabled() ) {
142 $out->addHTML( $msg->parseAsBlock() );
148 if ( !empty(
$options[
'toc'] ) && $haveModules ) {
153 $helptitle =
$options[
'helptitle'] ??
null;
158 if ( $cacheKey !==
null ) {
159 $cache->set( $cacheKey,
$out->getHTML(), $cacheHelpTimeout );
172 $formatter =
new HtmlFormatter(
$html );
173 $doc = $formatter->getDoc();
174 $xpath =
new DOMXPath( $doc );
175 $nodes = $xpath->query(
'//a[@href][not(contains(@class,\'apihelp-linktrail\'))]' );
176 foreach ( $nodes
as $node ) {
177 $href = $node->getAttribute(
'href' );
180 $href = rawurldecode( $href );
181 }
while ( $old !== $href );
182 if ( preg_match(
'!Special:ApiHelp/([^&/|#]+)((?:#.*)?)!', $href, $m ) ) {
183 if ( isset( $localModules[$m[1]] ) ) {
184 $href = $m[2] ===
'' ?
'#' . $m[1] : $m[2];
185 } elseif ( $helptitle !==
null ) {
186 $href = Title::newFromText( str_replace(
'$1', $m[1], $helptitle ) . $m[2] )
194 $node->setAttribute(
'href', $href );
195 $node->removeAttribute(
'title' );
199 return $formatter->getText();
210 private static function wrap(
Message $msg, $class, $tag =
'span' ) {
211 return Html::rawElement( $tag, [
'class' => $class ],
231 if ( empty(
$options[
'tocnumber'] ) ) {
232 $tocnumber = [ 2 => 0 ];
234 $tocnumber = &
$options[
'tocnumber'];
238 $tocnumber[$level]++;
239 $path = $module->getModulePath();
254 while ( isset( $haveModules[$anchor] ) ) {
255 $anchor =
$path .
'|' . ++$i;
258 if ( $module->isMain() ) {
259 $headerContent =
$context->
msg(
'api-help-main-header' )->parse();
261 'class' =>
'apihelp-header',
264 $name = $module->getModuleName();
265 $headerContent = $module->getParent()->getModuleManager()->getModuleGroup(
$name ) .
267 if ( $module->getModulePrefix() !==
'' ) {
268 $headerContent .=
' ' .
269 $context->
msg(
'parentheses', $module->getModulePrefix() )->parse();
275 'class' =>
'apihelp-header apihelp-module-name',
281 $headerAttr[
'id'] = $anchor;
283 $haveModules[$anchor] = [
284 'toclevel' => count( $tocnumber ),
287 'line' => $headerContent,
288 'number' => implode(
'.', $tocnumber ),
291 if ( empty(
$options[
'noheader'] ) ) {
292 $help[
'header'] .= Html::element(
293 'h' . min( 6, $level ),
299 $haveModules[
$path] =
true;
304 for ( $m = $module; $m !==
null; $m = $m->getParent() ) {
305 $name = $m->getModuleName();
306 if (
$name ===
'main_int' ) {
311 !( !empty(
$options[
'submodules'] ) && $m->getModuleManager() )
313 $link = Html::element(
'b', [
'dir' =>
'ltr',
'lang' =>
'en' ],
$name );
315 $link = SpecialPage::getTitleFor(
'ApiHelp', $m->getModulePath() )->getLocalURL();
316 $link = Html::element(
'a',
317 [
'href' =>
$link,
'class' =>
'apihelp-linktrail',
'dir' =>
'ltr',
'lang' =>
'en' ],
322 array_unshift( $links,
$link );
328 'apihelp-linktrail',
'div'
332 $flags = $module->getHelpFlags();
333 $help[
'flags'] .= Html::openElement(
'div',
334 [
'class' =>
'apihelp-block apihelp-flags' ] );
336 if ( !$msg->isDisabled() ) {
338 $msg->numParams( count( $flags ) ),
'apihelp-block-head',
'div'
341 $help[
'flags'] .= Html::openElement(
'ul' );
342 foreach ( $flags
as $flag ) {
343 $help[
'flags'] .= Html::rawElement(
'li',
null,
344 self::wrap(
$context->
msg(
"api-help-flag-$flag" ),
"apihelp-flag-$flag" )
347 $sourceInfo = $module->getModuleSourceInfo();
349 if ( isset( $sourceInfo[
'namemsg'] ) ) {
350 $extname =
$context->
msg( $sourceInfo[
'namemsg'] )->text();
353 $extname = Html::element(
'span', [
'dir' =>
'ltr',
'lang' =>
'en' ], $sourceInfo[
'name'] );
355 $help[
'flags'] .= Html::rawElement(
'li',
null,
357 $context->
msg(
'api-help-source', $extname, $sourceInfo[
'name'] ),
362 $link = SpecialPage::getTitleFor(
'Version',
'License/' . $sourceInfo[
'name'] );
363 if ( isset( $sourceInfo[
'license-name'] ) ) {
365 Html::element(
'span', [
'dir' =>
'ltr',
'lang' =>
'en' ], $sourceInfo[
'license-name'] )
370 $msg =
$context->
msg(
'api-help-license-unknown' );
372 $help[
'flags'] .= Html::rawElement(
'li',
null,
373 self::wrap( $msg,
'apihelp-license' )
376 $help[
'flags'] .= Html::rawElement(
'li',
null,
377 self::wrap(
$context->
msg(
'api-help-source-unknown' ),
'apihelp-source' )
379 $help[
'flags'] .= Html::rawElement(
'li',
null,
380 self::wrap(
$context->
msg(
'api-help-license-unknown' ),
'apihelp-license' )
383 $help[
'flags'] .= Html::closeElement(
'ul' );
384 $help[
'flags'] .= Html::closeElement(
'div' );
386 foreach ( $module->getFinalDescription()
as $msg ) {
388 $help[
'description'] .= $msg->parseAsBlock();
391 $urls = $module->getHelpUrls();
393 $help[
'help-urls'] .= Html::openElement(
'div',
394 [
'class' =>
'apihelp-block apihelp-help-urls' ]
397 if ( !$msg->isDisabled() ) {
399 $msg->numParams( count(
$urls ) ),
'apihelp-block-head',
'div'
402 if ( !is_array(
$urls ) ) {
405 $help[
'help-urls'] .= Html::openElement(
'ul' );
407 $help[
'help-urls'] .= Html::rawElement(
'li',
null,
408 Html::element(
'a', [
'href' => $url,
'dir' =>
'ltr' ], $url )
411 $help[
'help-urls'] .= Html::closeElement(
'ul' );
412 $help[
'help-urls'] .= Html::closeElement(
'div' );
416 $dynamicParams = $module->dynamicParameterDocumentation();
418 if (
$params || $dynamicParams !==
null ) {
419 $help[
'parameters'] .= Html::openElement(
'div',
420 [
'class' =>
'apihelp-block apihelp-parameters' ]
423 if ( !$msg->isDisabled() ) {
425 $msg->numParams( count(
$params ) ),
'apihelp-block-head',
'div'
428 $help[
'parameters'] .= Html::openElement(
'dl' );
430 $descriptions = $module->getFinalParamDescription();
433 if ( !is_array( $settings ) ) {
437 $help[
'parameters'] .= Html::rawElement(
'dt',
null,
438 Html::element(
'span', [
'dir' =>
'ltr',
'lang' =>
'en' ], $module->encodeParamName(
$name ) )
443 if ( isset( $descriptions[
$name] ) ) {
444 foreach ( $descriptions[
$name]
as $msg ) {
446 $description[] = $msg->parseAsBlock();
455 $info[] =
$context->
msg(
'api-help-param-required' )->parse();
461 $tag = array_shift( $i );
462 $info[] =
$context->
msg(
"apihelp-{$path}-paraminfo-{$tag}" )
463 ->numParams( count( $i ) )
465 ->params( $module->getModulePrefix() )
473 $msg =
'api-help-param-templated-var-first';
476 $msg =
'api-help-param-templated-var';
478 $info[] =
$context->
msg(
'api-help-param-templated' )
479 ->numParams( count(
$vars ) )
480 ->params( Message::listParam(
$vars ) )
487 if ( is_bool( $dflt ) ) {
489 } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
491 } elseif ( is_int( $dflt ) ) {
498 $hintPipeSeparated =
true;
503 if ( is_array(
$type ) ) {
504 $count = count(
$type );
507 $values = array_map(
function ( $v )
use ( $links, $deprecatedValues ) {
511 $attr[
'dir'] =
'auto';
513 if ( isset( $deprecatedValues[$v] ) ) {
514 $attr[
'class'] =
'apihelp-deprecated-value';
516 $ret = $attr ? Html::element(
'span', $attr, $v ) : $v;
517 if ( isset( $links[$v] ) ) {
518 $ret =
"[[{$links[$v]}|$ret]]";
522 $i = array_search(
'',
$type,
true );
523 if ( $i ===
false ) {
526 unset( $values[$i] );
527 $values =
$context->
msg(
'api-help-param-list-can-be-empty' )
528 ->numParams( count( $values ) )
533 ->params( $multi ? 2 : 1 )
536 $hintPipeSeparated =
false;
546 $prefix = $module->isMain() ?
'' : ( $module->getModulePath() .
'+' );
548 foreach ( $module->getModuleManager()->getNames(
$name )
as $submoduleName ) {
549 $map[$submoduleName] = $prefix . $submoduleName;
551 $defaultAttrs = [
'dir' =>
'ltr',
'lang' =>
'en' ];
556 $deprecatedSubmodules = [];
557 foreach ( $map
as $v => $m ) {
558 $attrs = $defaultAttrs;
561 $submod = $module->getModuleFromPath( $m );
562 if ( $submod && $submod->isDeprecated() ) {
563 $arr = &$deprecatedSubmodules;
564 $attrs[
'class'] =
'apihelp-deprecated-value';
570 $v = Html::element(
'span', $attrs, $v );
572 $arr[] =
"[[Special:ApiHelp/{$m}|{$v}]]";
574 $submodules = array_merge( $submodules, $deprecatedSubmodules );
575 $count = count( $submodules );
577 ->params( $multi ? 2 : 1 )
580 $hintPipeSeparated =
false;
595 ->params( $multi ? 2 : 1 )
598 $hintPipeSeparated =
false;
605 $count = count( $tags );
607 ->params( $multi ? 2 : 1 )
610 $hintPipeSeparated =
false;
642 if ( $suffix !==
'' ) {
645 ->params( $multi ? 2 : 1 )
646 ->numParams( $min, $max )
670 if ( is_string(
$type ) ) {
671 $msg =
$context->
msg(
"api-help-param-type-$type" );
672 if ( !$msg->isDisabled() ) {
673 $info[] = $msg->params( $multi ? 2 : 1 )->parse();
686 if ( $hintPipeSeparated ) {
687 $extra[] =
$context->
msg(
'api-help-param-multi-separate' )->parse();
689 if ( $count > $lowcount ) {
690 if ( $lowcount === $highcount ) {
691 $msg =
$context->
msg(
'api-help-param-multi-max-simple' )
692 ->numParams( $lowcount );
695 ->numParams( $lowcount, $highcount );
697 $extra[] = $msg->parse();
700 $info[] = implode(
' ', $extra );
710 $info[] =
$context->
msg(
'api-help-param-multi-all' )
711 ->params( $allSpecifier )
717 if ( isset( $settings[self::PARAM_MAX_BYTES] ) ) {
718 $info[] =
$context->
msg(
'api-help-param-maxbytes' )
719 ->numParams( $settings[self::PARAM_MAX_BYTES] );
721 if ( isset( $settings[self::PARAM_MAX_CHARS] ) ) {
722 $info[] =
$context->
msg(
'api-help-param-maxchars' )
723 ->numParams( $settings[self::PARAM_MAX_CHARS] );
728 if ( $default ===
'' ) {
729 $info[] =
$context->
msg(
'api-help-param-default-empty' )
731 } elseif ( $default !==
null && $default !==
false ) {
733 $info[] =
$context->
msg(
'api-help-param-default' )
734 ->params( Html::element(
'span', [
'dir' =>
'auto' ], $default ) )
738 if ( !array_filter( $description ) ) {
747 $help[
'parameters'] .= Html::openElement(
'dd',
748 [
'class' =>
'info' ] );
751 'apihelp-deprecated',
'strong'
753 $help[
'parameters'] .= Html::closeElement(
'dd' );
756 if ( $description ) {
757 $description = implode(
'', $description );
758 $description = preg_replace(
'!\s*</([oud]l)>\s*<\1>\s*!',
"\n", $description );
759 $help[
'parameters'] .= Html::rawElement(
'dd',
760 [
'class' =>
'description' ], $description );
763 foreach ( $info
as $i ) {
764 $help[
'parameters'] .= Html::rawElement(
'dd', [
'class' =>
'info' ], $i );
768 if ( $dynamicParams !==
null ) {
770 $module->getModulePrefix(),
771 $module->getModuleName(),
772 $module->getModulePath()
774 $help[
'parameters'] .= Html::element(
'dt',
null,
'*' );
775 $help[
'parameters'] .= Html::rawElement(
'dd',
776 [
'class' =>
'description' ], $dynamicParams->parse() );
779 $help[
'parameters'] .= Html::closeElement(
'dl' );
780 $help[
'parameters'] .= Html::closeElement(
'div' );
783 $examples = $module->getExamplesMessages();
785 $help[
'examples'] .= Html::openElement(
'div',
786 [
'class' =>
'apihelp-block apihelp-examples' ] );
788 if ( !$msg->isDisabled() ) {
790 $msg->numParams( count( $examples ) ),
'apihelp-block-head',
'div'
794 $help[
'examples'] .= Html::openElement(
'dl' );
795 foreach ( $examples
as $qs => $msg ) {
797 $module->getModulePrefix(),
798 $module->getModuleName(),
799 $module->getModulePath()
803 $sandbox = SpecialPage::getTitleFor(
'ApiSandbox' )->getLocalURL() .
'#' . $qs;
804 $help[
'examples'] .= Html::rawElement(
'dt',
null, $msg->parse() );
805 $help[
'examples'] .= Html::rawElement(
'dd',
null,
806 Html::element(
'a', [
'href' =>
$link,
'dir' =>
'ltr' ],
"api.php?$qs" ) .
' ' .
807 Html::rawElement(
'a', [
'href' => $sandbox ],
808 $context->
msg(
'api-help-open-in-apisandbox' )->parse() )
811 $help[
'examples'] .= Html::closeElement(
'dl' );
812 $help[
'examples'] .= Html::closeElement(
'div' );
815 $subtocnumber = $tocnumber;
816 $subtocnumber[$level + 1] = 0;
818 'submodules' =>
$options[
'recursivesubmodules'],
819 'headerlevel' => $level + 1,
820 'tocnumber' => &$subtocnumber,
824 if (
$options[
'submodules'] && $module->getModuleManager() ) {
825 $manager = $module->getModuleManager();
827 foreach ( $groups
as $group ) {
828 $names = $manager->getNames( $group );
831 $submodules[] = $manager->getModule(
$name );
842 $module->modifyHelp(
$help, $suboptions, $haveModules );
844 Hooks::run(
'APIHelpModifyOutput', [ $module, &
$help, $suboptions, &$haveModules ] );
867 $errorPrinter = $main->createPrinterByName( $main->getParameter(
'format' ) );
877 'submodules' =>
false,
878 'recursivesubmodules' =>
false,
887 =>
'apihelp-help-example-main',
888 'action=help&modules=query&submodules=1'
889 =>
'apihelp-help-example-submodules',
890 'action=help&recursivesubmodules=1'
891 =>
'apihelp-help-example-recursive',
892 'action=help&modules=help'
893 =>
'apihelp-help-example-help',
894 'action=help&modules=query+info|query+categorymembers'
895 =>
'apihelp-help-example-query',
901 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page',
902 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:FAQ',
903 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Quick_start_guide',
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_REQUIRED
(boolean) Is the parameter required?
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
getModuleFromPath( $path)
Get a module from its module path.
static makeMessage( $msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const PARAM_DEPRECATED_VALUES
(array) When PARAM_TYPE is an array, this indicates which of the values are deprecated.
const PARAM_ISMULTI_LIMIT1
(integer) Maximum number of values, for normal users.
getMain()
Get the main module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_VALUE_LINKS
(string[]) When PARAM_TYPE is an array, this may be an array mapping those values to page titles whic...
const PARAM_ISMULTI_LIMIT2
(integer) Maximum number of values, for users with the apihighimits right.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const LIMIT_SML2
Slow query, apihighlimits limit.
const PARAM_TEMPLATE_VARS
(array) Indicate that this is a templated parameter, and specify replacements.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getModulePath()
Get the path to this module.
const PARAM_EXTRA_NAMESPACES
(int[]) When PARAM_TYPE is 'namespace', include these as additional possible values.
const LIMIT_SML1
Slow query, standard limit.
const PARAM_ALL
(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true,...
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Class to output help for an API module.
static wrap(Message $msg, $class, $tag='span')
Wrap a message in HTML with a class.
isReadMode()
Indicates whether this module requires read rights.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getExamplesMessages()
Returns usage examples for this module.
static fixHelpLinks( $html, $helptitle=null, $localModules=[])
Replace Special:ApiHelp links with links to api.php.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
static getHelpInternal(IContextSource $context, array $modules, array $options, &$haveModules)
Recursively-called function to actually construct the help.
static getHelp(IContextSource $context, $modules, array $options)
Generate help for the specified modules.
shouldCheckMaxlag()
Indicates if this module needs maxlag to be checked.
getCustomPrinter()
If the module may only be used with a certain format module, it should override this method to return...
This is the main API class, used for both external and internal processing.
const NO_SIZE_CHECK
For addValue() and similar functions, do not check size while adding a value Don't use this unless yo...
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes.
Exception used to abort API execution with an error.
getContext()
Get the base IContextSource object.
An IContextSource implementation which will inherit context from another source but allow individual ...
static generateTOC( $tree, $lang=null)
Generate a table of contents from a section tree.
The Message class provides methods which fulfil two basic services:
parse()
Fully parse the text from wikitext to HTML.
This class should be covered by a general architecture document which does not exist as of January 20...
static getExtLicenseFileName( $extDir)
Obtains the full path of an extensions copying or license file if one exists.
static getVersion( $flags='', $lang=null)
Return a string of the MediaWiki version with Git revision if available.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
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 $out
namespace and then decline to actually register it & $namespaces
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 & $options
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
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 and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.
msg( $key)
This is the method for getting translated interface messages.
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))