MediaWiki  1.27.1
ApiParamInfo.php
Go to the documentation of this file.
1 <?php
30 class ApiParamInfo extends ApiBase {
31 
32  private $helpFormat;
33  private $context;
34 
35  public function __construct( ApiMain $main, $action ) {
36  parent::__construct( $main, $action );
37  }
38 
39  public function execute() {
40  // Get parameters
41  $params = $this->extractRequestParams();
42 
43  $this->helpFormat = $params['helpformat'];
44  $this->context = new RequestContext;
45  $this->context->setUser( new User ); // anon to avoid caching issues
46  $this->context->setLanguage( $this->getMain()->getLanguage() );
47 
48  if ( is_array( $params['modules'] ) ) {
49  $modules = $params['modules'];
50  } else {
51  $modules = [];
52  }
53 
54  if ( is_array( $params['querymodules'] ) ) {
55  $queryModules = $params['querymodules'];
56  foreach ( $queryModules as $m ) {
57  $modules[] = 'query+' . $m;
58  }
59  } else {
60  $queryModules = [];
61  }
62 
63  if ( is_array( $params['formatmodules'] ) ) {
64  $formatModules = $params['formatmodules'];
65  foreach ( $formatModules as $m ) {
66  $modules[] = $m;
67  }
68  } else {
69  $formatModules = [];
70  }
71 
72  $res = [];
73 
74  foreach ( $modules as $m ) {
75  try {
76  $module = $this->getModuleFromPath( $m );
77  } catch ( UsageException $ex ) {
78  $this->setWarning( $ex->getMessage() );
79  continue;
80  }
81  $key = 'modules';
82 
83  // Back compat
84  $isBCQuery = false;
85  if ( $module->getParent() && $module->getParent()->getModuleName() == 'query' &&
86  in_array( $module->getModuleName(), $queryModules )
87  ) {
88  $isBCQuery = true;
89  $key = 'querymodules';
90  }
91  if ( in_array( $module->getModuleName(), $formatModules ) ) {
92  $key = 'formatmodules';
93  }
94 
95  $item = $this->getModuleInfo( $module );
96  if ( $isBCQuery ) {
97  $item['querytype'] = $item['group'];
98  }
99  $res[$key][] = $item;
100  }
101 
102  $result = $this->getResult();
103  $result->addValue( [ $this->getModuleName() ], 'helpformat', $this->helpFormat );
104 
105  foreach ( $res as $key => $stuff ) {
106  ApiResult::setIndexedTagName( $res[$key], 'module' );
107  }
108 
109  if ( $params['mainmodule'] ) {
110  $res['mainmodule'] = $this->getModuleInfo( $this->getMain() );
111  }
112 
113  if ( $params['pagesetmodule'] ) {
114  $pageSet = new ApiPageSet( $this->getMain()->getModuleManager()->getModule( 'query' ) );
115  $res['pagesetmodule'] = $this->getModuleInfo( $pageSet );
116  unset( $res['pagesetmodule']['name'] );
117  unset( $res['pagesetmodule']['path'] );
118  unset( $res['pagesetmodule']['group'] );
119  }
120 
121  $result->addValue( null, $this->getModuleName(), $res );
122  }
123 
130  protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
131  switch ( $this->helpFormat ) {
132  case 'none':
133  break;
134 
135  case 'wikitext':
136  $ret = [];
137  foreach ( $msgs as $m ) {
138  $ret[] = $m->setContext( $this->context )->text();
139  }
140  $res[$key] = implode( "\n\n", $ret );
141  if ( $joinLists ) {
142  $res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] );
143  }
144  break;
145 
146  case 'html':
147  $ret = [];
148  foreach ( $msgs as $m ) {
149  $ret[] = $m->setContext( $this->context )->parseAsBlock();
150  }
151  $ret = implode( "\n", $ret );
152  if ( $joinLists ) {
153  $ret = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $ret );
154  }
156  break;
157 
158  case 'raw':
159  $res[$key] = [];
160  foreach ( $msgs as $m ) {
161  $a = [
162  'key' => $m->getKey(),
163  'params' => $m->getParams(),
164  ];
165  if ( $m instanceof ApiHelpParamValueMessage ) {
166  $a['forvalue'] = $m->getParamValue();
167  }
168  $res[$key][] = $a;
169  }
170  ApiResult::setIndexedTagName( $res[$key], 'msg' );
171  break;
172  }
173  }
174 
179  private function getModuleInfo( $module ) {
180  $ret = [];
181  $path = $module->getModulePath();
182 
183  $ret['name'] = $module->getModuleName();
184  $ret['classname'] = get_class( $module );
185  $ret['path'] = $path;
186  if ( !$module->isMain() ) {
187  $ret['group'] = $module->getParent()->getModuleManager()->getModuleGroup(
188  $module->getModuleName()
189  );
190  }
191  $ret['prefix'] = $module->getModulePrefix();
192 
193  $sourceInfo = $module->getModuleSourceInfo();
194  if ( $sourceInfo ) {
195  $ret['source'] = $sourceInfo['name'];
196  if ( isset( $sourceInfo['namemsg'] ) ) {
197  $ret['sourcename'] = $this->context->msg( $sourceInfo['namemsg'] )->text();
198  } else {
199  $ret['sourcename'] = $ret['source'];
200  }
201 
202  $link = SpecialPage::getTitleFor( 'Version', 'License/' . $sourceInfo['name'] )->getFullURL();
203  if ( isset( $sourceInfo['license-name'] ) ) {
204  $ret['licensetag'] = $sourceInfo['license-name'];
205  $ret['licenselink'] = (string)$link;
206  } elseif ( SpecialVersion::getExtLicenseFileName( dirname( $sourceInfo['path'] ) ) ) {
207  $ret['licenselink'] = (string)$link;
208  }
209  }
210 
211  $this->formatHelpMessages( $ret, 'description', $module->getFinalDescription() );
212 
213  foreach ( $module->getHelpFlags() as $flag ) {
214  $ret[$flag] = true;
215  }
216 
217  $ret['helpurls'] = (array)$module->getHelpUrls();
218  if ( isset( $ret['helpurls'][0] ) && $ret['helpurls'][0] === false ) {
219  $ret['helpurls'] = [];
220  }
221  ApiResult::setIndexedTagName( $ret['helpurls'], 'helpurl' );
222 
223  if ( $this->helpFormat !== 'none' ) {
224  $ret['examples'] = [];
225  $examples = $module->getExamplesMessages();
226  foreach ( $examples as $qs => $msg ) {
227  $item = [
228  'query' => $qs
229  ];
230  $msg = ApiBase::makeMessage( $msg, $this->context, [
231  $module->getModulePrefix(),
232  $module->getModuleName(),
233  $module->getModulePath()
234  ] );
235  $this->formatHelpMessages( $item, 'description', [ $msg ] );
236  if ( isset( $item['description'] ) ) {
237  if ( is_array( $item['description'] ) ) {
238  $item['description'] = $item['description'][0];
239  } else {
240  ApiResult::setSubelementsList( $item, 'description' );
241  }
242  }
243  $ret['examples'][] = $item;
244  }
245  ApiResult::setIndexedTagName( $ret['examples'], 'example' );
246  }
247 
248  $ret['parameters'] = [];
249  $params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
250  $paramDesc = $module->getFinalParamDescription();
251  foreach ( $params as $name => $settings ) {
252  if ( !is_array( $settings ) ) {
253  $settings = [ ApiBase::PARAM_DFLT => $settings ];
254  }
255 
256  $item = [
257  'name' => $name
258  ];
259  if ( isset( $paramDesc[$name] ) ) {
260  $this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
261  }
262 
263  $item['required'] = !empty( $settings[ApiBase::PARAM_REQUIRED] );
264 
265  if ( !empty( $settings[ApiBase::PARAM_DEPRECATED] ) ) {
266  $item['deprecated'] = true;
267  }
268 
269  if ( $name === 'token' && $module->needsToken() ) {
270  $item['tokentype'] = $module->needsToken();
271  }
272 
273  if ( !isset( $settings[ApiBase::PARAM_TYPE] ) ) {
274  $dflt = isset( $settings[ApiBase::PARAM_DFLT] )
275  ? $settings[ApiBase::PARAM_DFLT]
276  : null;
277  if ( is_bool( $dflt ) ) {
278  $settings[ApiBase::PARAM_TYPE] = 'boolean';
279  } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
280  $settings[ApiBase::PARAM_TYPE] = 'string';
281  } elseif ( is_int( $dflt ) ) {
282  $settings[ApiBase::PARAM_TYPE] = 'integer';
283  }
284  }
285 
286  if ( isset( $settings[ApiBase::PARAM_DFLT] ) ) {
287  switch ( $settings[ApiBase::PARAM_TYPE] ) {
288  case 'boolean':
289  $item['default'] = (bool)$settings[ApiBase::PARAM_DFLT];
290  break;
291  case 'string':
292  case 'text':
293  case 'password':
294  $item['default'] = strval( $settings[ApiBase::PARAM_DFLT] );
295  break;
296  case 'integer':
297  case 'limit':
298  $item['default'] = intval( $settings[ApiBase::PARAM_DFLT] );
299  break;
300  case 'timestamp':
301  $item['default'] = wfTimestamp( TS_ISO_8601, $settings[ApiBase::PARAM_DFLT] );
302  break;
303  default:
304  $item['default'] = $settings[ApiBase::PARAM_DFLT];
305  break;
306  }
307  }
308 
309  $item['multi'] = !empty( $settings[ApiBase::PARAM_ISMULTI] );
310  if ( $item['multi'] ) {
311  $item['limit'] = $this->getMain()->canApiHighLimits() ?
314  $item['lowlimit'] = ApiBase::LIMIT_SML1;
315  $item['highlimit'] = ApiBase::LIMIT_SML2;
316  }
317 
318  if ( !empty( $settings[ApiBase::PARAM_ALLOW_DUPLICATES] ) ) {
319  $item['allowsduplicates'] = true;
320  }
321 
322  if ( isset( $settings[ApiBase::PARAM_TYPE] ) ) {
323  if ( $settings[ApiBase::PARAM_TYPE] === 'submodule' ) {
324  if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
325  ksort( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
326  $item['type'] = array_keys( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
327  $item['submodules'] = $settings[ApiBase::PARAM_SUBMODULE_MAP];
328  } else {
329  $item['type'] = $module->getModuleManager()->getNames( $name );
330  sort( $item['type'] );
331  $prefix = $module->isMain()
332  ? '' : ( $module->getModulePath() . '+' );
333  $item['submodules'] = [];
334  foreach ( $item['type'] as $v ) {
335  $item['submodules'][$v] = $prefix . $v;
336  }
337  }
338  if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
339  $item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
340  }
341  } elseif ( $settings[ApiBase::PARAM_TYPE] === 'tags' ) {
342  $item['type'] = ChangeTags::listExplicitlyDefinedTags();
343  } else {
344  $item['type'] = $settings[ApiBase::PARAM_TYPE];
345  }
346  if ( is_array( $item['type'] ) ) {
347  // To prevent sparse arrays from being serialized to JSON as objects
348  $item['type'] = array_values( $item['type'] );
349  ApiResult::setIndexedTagName( $item['type'], 't' );
350  }
351  }
352  if ( isset( $settings[ApiBase::PARAM_MAX] ) ) {
353  $item['max'] = $settings[ApiBase::PARAM_MAX];
354  }
355  if ( isset( $settings[ApiBase::PARAM_MAX2] ) ) {
356  $item['highmax'] = $settings[ApiBase::PARAM_MAX2];
357  }
358  if ( isset( $settings[ApiBase::PARAM_MIN] ) ) {
359  $item['min'] = $settings[ApiBase::PARAM_MIN];
360  }
361  if ( !empty( $settings[ApiBase::PARAM_RANGE_ENFORCE] ) ) {
362  $item['enforcerange'] = true;
363  }
364 
365  if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
366  $item['info'] = [];
367  foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
368  $tag = array_shift( $i );
369  $info = [
370  'name' => $tag,
371  ];
372  if ( count( $i ) ) {
373  $info['values'] = $i;
374  ApiResult::setIndexedTagName( $info['values'], 'v' );
375  }
376  $this->formatHelpMessages( $info, 'text', [
377  $this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
378  ->numParams( count( $i ) )
379  ->params( $this->context->getLanguage()->commaList( $i ) )
380  ->params( $module->getModulePrefix() )
381  ] );
382  ApiResult::setSubelementsList( $info, 'text' );
383  $item['info'][] = $info;
384  }
385  ApiResult::setIndexedTagName( $item['info'], 'i' );
386  }
387 
388  $ret['parameters'][] = $item;
389  }
390  ApiResult::setIndexedTagName( $ret['parameters'], 'param' );
391 
392  $dynamicParams = $module->dynamicParameterDocumentation();
393  if ( $dynamicParams !== null ) {
394  if ( $this->helpFormat === 'none' ) {
395  $ret['dynamicparameters'] = true;
396  } else {
397  $dynamicParams = ApiBase::makeMessage( $dynamicParams, $this->context, [
398  $module->getModulePrefix(),
399  $module->getModuleName(),
400  $module->getModulePath()
401  ] );
402  $this->formatHelpMessages( $ret, 'dynamicparameters', [ $dynamicParams ] );
403  }
404  }
405 
406  return $ret;
407  }
408 
409  public function isReadMode() {
410  return false;
411  }
412 
413  public function getAllowedParams() {
414  // back compat
415  $querymodules = $this->getMain()->getModuleManager()
416  ->getModule( 'query' )->getModuleManager()->getNames();
417  sort( $querymodules );
418  $formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
419  sort( $formatmodules );
420 
421  return [
422  'modules' => [
423  ApiBase::PARAM_ISMULTI => true,
424  ],
425  'helpformat' => [
426  ApiBase::PARAM_DFLT => 'none',
427  ApiBase::PARAM_TYPE => [ 'html', 'wikitext', 'raw', 'none' ],
428  ],
429 
430  'querymodules' => [
432  ApiBase::PARAM_ISMULTI => true,
433  ApiBase::PARAM_TYPE => $querymodules,
434  ],
435  'mainmodule' => [
437  ],
438  'pagesetmodule' => [
440  ],
441  'formatmodules' => [
443  ApiBase::PARAM_ISMULTI => true,
444  ApiBase::PARAM_TYPE => $formatmodules,
445  ]
446  ];
447  }
448 
449  protected function getExamplesMessages() {
450  return [
451  'action=paraminfo&modules=parse|phpfm|query+allpages|query+siteinfo'
452  => 'apihelp-paraminfo-example-1',
453  ];
454  }
455 
456  public function getHelpUrls() {
457  return 'https://www.mediawiki.org/wiki/API:Parameter_information';
458  }
459 }
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Definition: ApiBase.php:88
getModuleInfo($module)
the array() calling protocol came about after MediaWiki 1.4rc1.
getResult()
Get the result object.
Definition: ApiBase.php:577
getLanguage()
Get the Language object.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
Message subclass that prepends wikitext for API help.
Group all the pieces relevant to the context of a request into one instance.
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:41
__construct(ApiMain $main, $action)
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:75
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
Definition: hooks.txt:1798
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:50
getMain()
Get the main module.
Definition: ApiBase.php:473
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
Definition: ApiBase.php:190
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:91
const PARAM_REQUIRED
(boolean) Is the parameter required?
Definition: ApiBase.php:112
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
Definition: ApiBase.php:142
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
Definition: ApiBase.php:678
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
Definition: hooks.txt:177
static makeMessage($msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
Definition: ApiBase.php:1418
static listExplicitlyDefinedTags()
Lists tags explicitly defined in the valid_tag table of the database.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:618
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. '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 '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. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) '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 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) '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:Associative array mapping language codes to prefixed links of the form"language:title".&$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':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
Definition: hooks.txt:1796
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
Definition: hooks.txt:2581
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_SUBMODULE_PARAM_PREFIX
(string) When PARAM_TYPE is 'submodule', used to indicate the 'g' prefix added by ApiQueryGeneratorBa...
Definition: ApiBase.php:172
static stripOuterParagraph($html)
Strip outer.
Definition: Parser.php:6442
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
const PARAM_RANGE_ENFORCE
(boolean) For PARAM_TYPE 'integer', enforce PARAM_MIN and PARAM_MAX?
Definition: ApiBase.php:118
$res
Definition: database.txt:21
formatHelpMessages(array &$res, $key, array $msgs, $joinLists=false)
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition: ApiBase.php:183
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is 'submodule', map parameter values to submodule paths.
Definition: ApiBase.php:165
$params
This is the main API class, used for both external and internal processing.
Definition: ApiMain.php:41
static getExtLicenseFileName($extDir)
Obtains the full path of an extensions copying or license file if one exists.
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:457
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
Definition: hooks.txt:965
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
Definition: ApiBase.php:97
setWarning($warning)
Set warning section for this module.
Definition: ApiBase.php:1450
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
Definition: distributors.txt:9
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes...
Definition: ApiResult.php:567
const LIMIT_SML1
Slow query, standard limit.
Definition: ApiBase.php:181
getModuleManager()
Get the module manager, or null if this module has no sub-modules.
Definition: ApiBase.php:247
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
Definition: injection.txt:35
setUser(User $u)
Set the User object.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:53
This abstract class implements many basic API functions, and is the base of all API classes...
Definition: ApiBase.php:39
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:106
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:100
const PARAM_ALLOW_DUPLICATES
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
Definition: ApiBase.php:103
getModuleFromPath($path)
Get a module from its module path.
Definition: ApiBase.php:539
This exception will be thrown when dieUsage is called to stop module execution.
Definition: ApiMain.php:1876
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310