MediaWiki  master
ApiParamInfo.php
Go to the documentation of this file.
1 <?php
26 class ApiParamInfo extends ApiBase {
27 
28  private $helpFormat;
29  private $context;
30 
31  public function __construct( ApiMain $main, $action ) {
32  parent::__construct( $main, $action );
33  }
34 
35  public function execute() {
36  // Get parameters
37  $params = $this->extractRequestParams();
38 
39  $this->helpFormat = $params['helpformat'];
40  $this->context = new RequestContext;
41  $this->context->setUser( new User ); // anon to avoid caching issues
42  $this->context->setLanguage( $this->getMain()->getLanguage() );
43 
44  if ( is_array( $params['modules'] ) ) {
45  $modules = [];
46  foreach ( $params['modules'] as $path ) {
47  if ( $path === '*' || $path === '**' ) {
48  $path = "main+$path";
49  }
50  if ( substr( $path, -2 ) === '+*' || substr( $path, -2 ) === ' *' ) {
51  $submodules = true;
52  $path = substr( $path, 0, -2 );
53  $recursive = false;
54  } elseif ( substr( $path, -3 ) === '+**' || substr( $path, -3 ) === ' **' ) {
55  $submodules = true;
56  $path = substr( $path, 0, -3 );
57  $recursive = true;
58  } else {
59  $submodules = false;
60  }
61 
62  if ( $submodules ) {
63  try {
64  $module = $this->getModuleFromPath( $path );
65  } catch ( ApiUsageException $ex ) {
66  foreach ( $ex->getStatusValue()->getErrors() as $error ) {
67  $this->addWarning( $error );
68  }
69  continue;
70  }
71  $submodules = $this->listAllSubmodules( $module, $recursive );
72  if ( $submodules ) {
73  $modules = array_merge( $modules, $submodules );
74  } else {
75  $this->addWarning( [ 'apierror-badmodule-nosubmodules', $path ], 'badmodule' );
76  }
77  } else {
78  $modules[] = $path;
79  }
80  }
81  } else {
82  $modules = [];
83  }
84 
85  if ( is_array( $params['querymodules'] ) ) {
86  $queryModules = $params['querymodules'];
87  foreach ( $queryModules as $m ) {
88  $modules[] = 'query+' . $m;
89  }
90  } else {
91  $queryModules = [];
92  }
93 
94  if ( is_array( $params['formatmodules'] ) ) {
95  $formatModules = $params['formatmodules'];
96  foreach ( $formatModules as $m ) {
97  $modules[] = $m;
98  }
99  } else {
100  $formatModules = [];
101  }
102 
103  $modules = array_unique( $modules );
104 
105  $res = [];
106 
107  foreach ( $modules as $m ) {
108  try {
109  $module = $this->getModuleFromPath( $m );
110  } catch ( ApiUsageException $ex ) {
111  foreach ( $ex->getStatusValue()->getErrors() as $error ) {
112  $this->addWarning( $error );
113  }
114  continue;
115  }
116  $key = 'modules';
117 
118  // Back compat
119  $isBCQuery = false;
120  if ( $module->getParent() && $module->getParent()->getModuleName() == 'query' &&
121  in_array( $module->getModuleName(), $queryModules )
122  ) {
123  $isBCQuery = true;
124  $key = 'querymodules';
125  }
126  if ( in_array( $module->getModuleName(), $formatModules ) ) {
127  $key = 'formatmodules';
128  }
129 
130  $item = $this->getModuleInfo( $module );
131  if ( $isBCQuery ) {
132  $item['querytype'] = $item['group'];
133  }
134  $res[$key][] = $item;
135  }
136 
137  $result = $this->getResult();
138  $result->addValue( [ $this->getModuleName() ], 'helpformat', $this->helpFormat );
139 
140  foreach ( $res as $key => $stuff ) {
141  ApiResult::setIndexedTagName( $res[$key], 'module' );
142  }
143 
144  if ( $params['mainmodule'] ) {
145  $res['mainmodule'] = $this->getModuleInfo( $this->getMain() );
146  }
147 
148  if ( $params['pagesetmodule'] ) {
149  $pageSet = new ApiPageSet( $this->getMain()->getModuleManager()->getModule( 'query' ) );
150  $res['pagesetmodule'] = $this->getModuleInfo( $pageSet );
151  unset( $res['pagesetmodule']['name'] );
152  unset( $res['pagesetmodule']['path'] );
153  unset( $res['pagesetmodule']['group'] );
154  }
155 
156  $result->addValue( null, $this->getModuleName(), $res );
157  }
158 
165  private function listAllSubmodules( ApiBase $module, $recursive ) {
166  $manager = $module->getModuleManager();
167  if ( $manager ) {
168  $paths = [];
169  $names = $manager->getNames();
170  sort( $names );
171  foreach ( $names as $name ) {
172  $submodule = $manager->getModule( $name );
173  $paths[] = $submodule->getModulePath();
174  if ( $recursive && $submodule->getModuleManager() ) {
175  $paths = array_merge( $paths, $this->listAllSubmodules( $submodule, $recursive ) );
176  }
177  }
178  }
179  return $paths;
180  }
181 
188  protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
189  switch ( $this->helpFormat ) {
190  case 'none':
191  break;
192 
193  case 'wikitext':
194  $ret = [];
195  foreach ( $msgs as $m ) {
196  $ret[] = $m->setContext( $this->context )->text();
197  }
198  $res[$key] = implode( "\n\n", $ret );
199  if ( $joinLists ) {
200  $res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] );
201  }
202  break;
203 
204  case 'html':
205  $ret = [];
206  foreach ( $msgs as $m ) {
207  $ret[] = $m->setContext( $this->context )->parseAsBlock();
208  }
209  $ret = implode( "\n", $ret );
210  if ( $joinLists ) {
211  $ret = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $ret );
212  }
213  $res[$key] = Parser::stripOuterParagraph( $ret );
214  break;
215 
216  case 'raw':
217  $res[$key] = [];
218  foreach ( $msgs as $m ) {
219  $a = [
220  'key' => $m->getKey(),
221  'params' => $m->getParams(),
222  ];
223  ApiResult::setIndexedTagName( $a['params'], 'param' );
224  if ( $m instanceof ApiHelpParamValueMessage ) {
225  $a['forvalue'] = $m->getParamValue();
226  }
227  $res[$key][] = $a;
228  }
229  ApiResult::setIndexedTagName( $res[$key], 'msg' );
230  break;
231  }
232  }
233 
238  private function getModuleInfo( $module ) {
239  $ret = [];
240  $path = $module->getModulePath();
241 
242  $ret['name'] = $module->getModuleName();
243  $ret['classname'] = get_class( $module );
244  $ret['path'] = $path;
245  if ( !$module->isMain() ) {
246  $ret['group'] = $module->getParent()->getModuleManager()->getModuleGroup(
247  $module->getModuleName()
248  );
249  }
250  $ret['prefix'] = $module->getModulePrefix();
251 
252  $sourceInfo = $module->getModuleSourceInfo();
253  if ( $sourceInfo ) {
254  $ret['source'] = $sourceInfo['name'];
255  if ( isset( $sourceInfo['namemsg'] ) ) {
256  $ret['sourcename'] = $this->context->msg( $sourceInfo['namemsg'] )->text();
257  } else {
258  $ret['sourcename'] = $ret['source'];
259  }
260 
261  $link = SpecialPage::getTitleFor( 'Version', 'License/' . $sourceInfo['name'] )->getFullURL();
262  if ( isset( $sourceInfo['license-name'] ) ) {
263  $ret['licensetag'] = $sourceInfo['license-name'];
264  $ret['licenselink'] = (string)$link;
265  } elseif ( SpecialVersion::getExtLicenseFileName( dirname( $sourceInfo['path'] ) ) ) {
266  $ret['licenselink'] = (string)$link;
267  }
268  }
269 
270  $this->formatHelpMessages( $ret, 'description', $module->getFinalDescription() );
271 
272  foreach ( $module->getHelpFlags() as $flag ) {
273  $ret[$flag] = true;
274  }
275 
276  $ret['helpurls'] = (array)$module->getHelpUrls();
277  if ( isset( $ret['helpurls'][0] ) && $ret['helpurls'][0] === false ) {
278  $ret['helpurls'] = [];
279  }
280  ApiResult::setIndexedTagName( $ret['helpurls'], 'helpurl' );
281 
282  if ( $this->helpFormat !== 'none' ) {
283  $ret['examples'] = [];
284  $examples = $module->getExamplesMessages();
285  foreach ( $examples as $qs => $msg ) {
286  $item = [
287  'query' => $qs
288  ];
289  $msg = ApiBase::makeMessage( $msg, $this->context, [
290  $module->getModulePrefix(),
291  $module->getModuleName(),
292  $module->getModulePath()
293  ] );
294  $this->formatHelpMessages( $item, 'description', [ $msg ] );
295  if ( isset( $item['description'] ) ) {
296  if ( is_array( $item['description'] ) ) {
297  $item['description'] = $item['description'][0];
298  } else {
299  ApiResult::setSubelementsList( $item, 'description' );
300  }
301  }
302  $ret['examples'][] = $item;
303  }
304  ApiResult::setIndexedTagName( $ret['examples'], 'example' );
305  }
306 
307  $ret['parameters'] = [];
308  $ret['templatedparameters'] = [];
309  $params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
310  $paramDesc = $module->getFinalParamDescription();
311  $index = 0;
312  foreach ( $params as $name => $settings ) {
313  if ( !is_array( $settings ) ) {
314  $settings = [ ApiBase::PARAM_DFLT => $settings ];
315  }
316 
317  $item = [
318  'index' => ++$index,
319  'name' => $name,
320  ];
321 
322  if ( !empty( $settings[ApiBase::PARAM_TEMPLATE_VARS] ) ) {
323  $item['templatevars'] = $settings[ApiBase::PARAM_TEMPLATE_VARS];
324  ApiResult::setIndexedTagName( $item['templatevars'], 'var' );
325  }
326 
327  if ( isset( $paramDesc[$name] ) ) {
328  $this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
329  }
330 
331  $item['required'] = !empty( $settings[ApiBase::PARAM_REQUIRED] );
332 
333  if ( !empty( $settings[ApiBase::PARAM_DEPRECATED] ) ) {
334  $item['deprecated'] = true;
335  }
336 
337  if ( $name === 'token' && $module->needsToken() ) {
338  $item['tokentype'] = $module->needsToken();
339  }
340 
341  if ( !isset( $settings[ApiBase::PARAM_TYPE] ) ) {
342  $dflt = $settings[ApiBase::PARAM_DFLT] ?? null;
343  if ( is_bool( $dflt ) ) {
344  $settings[ApiBase::PARAM_TYPE] = 'boolean';
345  } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
346  $settings[ApiBase::PARAM_TYPE] = 'string';
347  } elseif ( is_int( $dflt ) ) {
348  $settings[ApiBase::PARAM_TYPE] = 'integer';
349  }
350  }
351 
352  if ( isset( $settings[ApiBase::PARAM_DFLT] ) ) {
353  switch ( $settings[ApiBase::PARAM_TYPE] ) {
354  case 'boolean':
355  $item['default'] = (bool)$settings[ApiBase::PARAM_DFLT];
356  break;
357  case 'string':
358  case 'text':
359  case 'password':
360  $item['default'] = strval( $settings[ApiBase::PARAM_DFLT] );
361  break;
362  case 'integer':
363  case 'limit':
364  $item['default'] = (int)$settings[ApiBase::PARAM_DFLT];
365  break;
366  case 'timestamp':
367  $item['default'] = wfTimestamp( TS_ISO_8601, $settings[ApiBase::PARAM_DFLT] );
368  break;
369  default:
370  $item['default'] = $settings[ApiBase::PARAM_DFLT];
371  break;
372  }
373  }
374 
375  $item['multi'] = !empty( $settings[ApiBase::PARAM_ISMULTI] );
376  if ( $item['multi'] ) {
377  $item['lowlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT1] )
378  ? $settings[ApiBase::PARAM_ISMULTI_LIMIT1]
380  $item['highlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT2] )
381  ? $settings[ApiBase::PARAM_ISMULTI_LIMIT2]
383  $item['limit'] = $this->getMain()->canApiHighLimits()
384  ? $item['highlimit']
385  : $item['lowlimit'];
386  }
387 
388  if ( !empty( $settings[ApiBase::PARAM_ALLOW_DUPLICATES] ) ) {
389  $item['allowsduplicates'] = true;
390  }
391 
392  if ( isset( $settings[ApiBase::PARAM_TYPE] ) ) {
393  if ( $settings[ApiBase::PARAM_TYPE] === 'submodule' ) {
394  if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
395  $item['type'] = array_keys( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
396  $item['submodules'] = $settings[ApiBase::PARAM_SUBMODULE_MAP];
397  } else {
398  $item['type'] = $module->getModuleManager()->getNames( $name );
399  $prefix = $module->isMain()
400  ? '' : ( $module->getModulePath() . '+' );
401  $item['submodules'] = [];
402  foreach ( $item['type'] as $v ) {
403  $item['submodules'][$v] = $prefix . $v;
404  }
405  }
406  if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
407  $item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
408  }
409 
410  $submoduleFlags = []; // for sorting: higher flags are sorted later
411  $submoduleNames = []; // for sorting: lexicographical, ascending
412  foreach ( $item['submodules'] as $v => $submodulePath ) {
413  try {
414  $submod = $this->getModuleFromPath( $submodulePath );
415  } catch ( ApiUsageException $ex ) {
416  $submoduleFlags[] = 0;
417  $submoduleNames[] = $v;
418  continue;
419  }
420  $flags = 0;
421  if ( $submod && $submod->isDeprecated() ) {
422  $item['deprecatedvalues'][] = $v;
423  $flags |= 1;
424  }
425  if ( $submod && $submod->isInternal() ) {
426  $item['internalvalues'][] = $v;
427  $flags |= 2;
428  }
429  $submoduleFlags[] = $flags;
430  $submoduleNames[] = $v;
431  }
432  // sort $item['submodules'] and $item['type'] by $submoduleFlags and $submoduleNames
433  array_multisort( $submoduleFlags, $submoduleNames, $item['submodules'], $item['type'] );
434  if ( isset( $item['deprecatedvalues'] ) ) {
435  sort( $item['deprecatedvalues'] );
436  }
437  if ( isset( $item['internalvalues'] ) ) {
438  sort( $item['internalvalues'] );
439  }
440  } elseif ( $settings[ApiBase::PARAM_TYPE] === 'tags' ) {
441  $item['type'] = ChangeTags::listExplicitlyDefinedTags();
442  } else {
443  $item['type'] = $settings[ApiBase::PARAM_TYPE];
444  }
445  if ( is_array( $item['type'] ) ) {
446  // To prevent sparse arrays from being serialized to JSON as objects
447  $item['type'] = array_values( $item['type'] );
448  ApiResult::setIndexedTagName( $item['type'], 't' );
449  }
450 
451  // Add 'allspecifier' if applicable
452  if ( $item['type'] === 'namespace' ) {
453  $allowAll = true;
454  $allSpecifier = ApiBase::ALL_DEFAULT_STRING;
455  } else {
456  $allowAll = $settings[ApiBase::PARAM_ALL] ?? false;
457  $allSpecifier = ( is_string( $allowAll ) ? $allowAll : ApiBase::ALL_DEFAULT_STRING );
458  }
459  if ( $allowAll && $item['multi'] &&
460  ( is_array( $item['type'] ) || $item['type'] === 'namespace' ) ) {
461  $item['allspecifier'] = $allSpecifier;
462  }
463 
464  if ( $item['type'] === 'namespace' &&
465  isset( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) &&
466  is_array( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] )
467  ) {
468  $item['extranamespaces'] = $settings[ApiBase::PARAM_EXTRA_NAMESPACES];
469  ApiResult::setArrayType( $item['extranamespaces'], 'array' );
470  ApiResult::setIndexedTagName( $item['extranamespaces'], 'ns' );
471  }
472  }
473  if ( isset( $settings[ApiBase::PARAM_MAX] ) ) {
474  $item['max'] = $settings[ApiBase::PARAM_MAX];
475  }
476  if ( isset( $settings[ApiBase::PARAM_MAX2] ) ) {
477  $item['highmax'] = $settings[ApiBase::PARAM_MAX2];
478  }
479  if ( isset( $settings[ApiBase::PARAM_MIN] ) ) {
480  $item['min'] = $settings[ApiBase::PARAM_MIN];
481  }
482  if ( !empty( $settings[ApiBase::PARAM_RANGE_ENFORCE] ) ) {
483  $item['enforcerange'] = true;
484  }
485  if ( isset( $settings[self::PARAM_MAX_BYTES] ) ) {
486  $item['maxbytes'] = $settings[self::PARAM_MAX_BYTES];
487  }
488  if ( isset( $settings[self::PARAM_MAX_CHARS] ) ) {
489  $item['maxchars'] = $settings[self::PARAM_MAX_CHARS];
490  }
491  if ( !empty( $settings[ApiBase::PARAM_DEPRECATED_VALUES] ) ) {
492  $deprecatedValues = array_keys( $settings[ApiBase::PARAM_DEPRECATED_VALUES] );
493  if ( is_array( $item['type'] ) ) {
494  $deprecatedValues = array_intersect( $deprecatedValues, $item['type'] );
495  }
496  if ( $deprecatedValues ) {
497  $item['deprecatedvalues'] = array_values( $deprecatedValues );
498  ApiResult::setIndexedTagName( $item['deprecatedvalues'], 'v' );
499  }
500  }
501 
502  if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
503  $item['info'] = [];
504  foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
505  $tag = array_shift( $i );
506  $info = [
507  'name' => $tag,
508  ];
509  if ( count( $i ) ) {
510  $info['values'] = $i;
511  ApiResult::setIndexedTagName( $info['values'], 'v' );
512  }
513  $this->formatHelpMessages( $info, 'text', [
514  $this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
515  ->numParams( count( $i ) )
516  ->params( $this->context->getLanguage()->commaList( $i ) )
517  ->params( $module->getModulePrefix() )
518  ] );
519  ApiResult::setSubelementsList( $info, 'text' );
520  $item['info'][] = $info;
521  }
522  ApiResult::setIndexedTagName( $item['info'], 'i' );
523  }
524 
525  $key = empty( $settings[ApiBase::PARAM_TEMPLATE_VARS] ) ? 'parameters' : 'templatedparameters';
526  $ret[$key][] = $item;
527  }
528  ApiResult::setIndexedTagName( $ret['parameters'], 'param' );
529  ApiResult::setIndexedTagName( $ret['templatedparameters'], 'param' );
530 
531  $dynamicParams = $module->dynamicParameterDocumentation();
532  if ( $dynamicParams !== null ) {
533  if ( $this->helpFormat === 'none' ) {
534  $ret['dynamicparameters'] = true;
535  } else {
536  $dynamicParams = ApiBase::makeMessage( $dynamicParams, $this->context, [
537  $module->getModulePrefix(),
538  $module->getModuleName(),
539  $module->getModulePath()
540  ] );
541  $this->formatHelpMessages( $ret, 'dynamicparameters', [ $dynamicParams ] );
542  }
543  }
544 
545  return $ret;
546  }
547 
548  public function isReadMode() {
549  return false;
550  }
551 
552  public function getAllowedParams() {
553  // back compat
554  $querymodules = $this->getMain()->getModuleManager()
555  ->getModule( 'query' )->getModuleManager()->getNames();
556  sort( $querymodules );
557  $formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
558  sort( $formatmodules );
559 
560  return [
561  'modules' => [
562  ApiBase::PARAM_ISMULTI => true,
563  ],
564  'helpformat' => [
565  ApiBase::PARAM_DFLT => 'none',
566  ApiBase::PARAM_TYPE => [ 'html', 'wikitext', 'raw', 'none' ],
567  ],
568 
569  'querymodules' => [
571  ApiBase::PARAM_ISMULTI => true,
572  ApiBase::PARAM_TYPE => $querymodules,
573  ],
574  'mainmodule' => [
576  ],
577  'pagesetmodule' => [
579  ],
580  'formatmodules' => [
582  ApiBase::PARAM_ISMULTI => true,
583  ApiBase::PARAM_TYPE => $formatmodules,
584  ]
585  ];
586  }
587 
588  protected function getExamplesMessages() {
589  return [
590  'action=paraminfo&modules=parse|phpfm|query%2Ballpages|query%2Bsiteinfo'
591  => 'apihelp-paraminfo-example-1',
592  'action=paraminfo&modules=query%2B*'
593  => 'apihelp-paraminfo-example-2',
594  ];
595  }
596 
597  public function getHelpUrls() {
598  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Parameter_information';
599  }
600 }
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Definition: ApiBase.php:94
getResult()
Get the result object.
Definition: ApiBase.php:640
Message subclass that prepends wikitext for API help.
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:40
__construct(ApiMain $main, $action)
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:55
getMain()
Get the main module.
Definition: ApiBase.php:536
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
Definition: ApiBase.php:272
Exception used to abort API execution with an error.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE &#39;integer&#39; and &#39;limit&#39;.
Definition: ApiBase.php:97
const PARAM_REQUIRED
(boolean) Is the parameter required?
Definition: ApiBase.php:118
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
Definition: ApiBase.php:148
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user...
Definition: ApiBase.php:761
static listExplicitlyDefinedTags()
Lists tags explicitly defined in the change_tag_def table of the database.
const PARAM_ALL
(boolean|string) When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true...
Definition: ApiBase.php:187
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
const PARAM_ISMULTI_LIMIT1
(integer) Maximum number of values, for normal users.
Definition: ApiBase.php:215
static makeMessage( $msg, IContextSource $context, array $params=null)
Create a Message from a string or array.
Definition: ApiBase.php:1791
static stripOuterParagraph( $html)
Strip outer.
Definition: Parser.php:6458
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
Definition: User.php:51
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
$modules
const PARAM_SUBMODULE_PARAM_PREFIX
(string) When PARAM_TYPE is &#39;submodule&#39;, used to indicate the &#39;g&#39; prefix added by ApiQueryGeneratorBa...
Definition: ApiBase.php:179
const PARAM_ISMULTI_LIMIT2
(integer) Maximum number of values, for users with the apihighimits right.
Definition: ApiBase.php:222
const PARAM_RANGE_ENFORCE
(boolean) For PARAM_TYPE &#39;integer&#39;, enforce PARAM_MIN and PARAM_MAX?
Definition: ApiBase.php:124
formatHelpMessages(array &$res, $key, array $msgs, $joinLists=false)
const LIMIT_SML2
Slow query, apihighlimits limit.
Definition: ApiBase.php:265
const PARAM_SUBMODULE_MAP
(string[]) When PARAM_TYPE is &#39;submodule&#39;, map parameter values to submodule paths.
Definition: ApiBase.php:172
This is the main API class, used for both external and internal processing.
Definition: ApiMain.php:42
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:520
static getExtLicenseFileName( $extDir)
Obtains the full path of an extensions copying or license file if one exists.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE &#39;limit&#39;.
Definition: ApiBase.php:103
getModuleFromPath( $path)
Get a module from its module path.
Definition: ApiBase.php:602
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don&#39;t need a full Title object...
Definition: SpecialPage.php:83
static setSubelementsList(array &$arr, $names)
Causes the elements with the specified names to be output as subelements rather than attributes...
Definition: ApiResult.php:565
const LIMIT_SML1
Slow query, standard limit.
Definition: ApiBase.php:263
const PARAM_TEMPLATE_VARS
(array) Indicate that this is a templated parameter, and specify replacements.
Definition: ApiBase.php:252
getModuleManager()
Get the module manager, or null if this module has no sub-modules.
Definition: ApiBase.php:341
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition: ApiBase.php:1924
const PARAM_DEPRECATED_VALUES
(array) When PARAM_TYPE is an array, this indicates which of the values are deprecated.
Definition: ApiBase.php:209
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:58
const ALL_DEFAULT_STRING
Definition: ApiBase.php:256
This abstract class implements many basic API functions, and is the base of all API classes...
Definition: ApiBase.php:42
const PARAM_EXTRA_NAMESPACES
(int[]) When PARAM_TYPE is &#39;namespace&#39;, include these as additional possible values.
Definition: ApiBase.php:193
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:112
getModuleInfo( $module)
getStatusValue()
Fetch the error status.
listAllSubmodules(ApiBase $module, $recursive)
List all submodules of a module.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE &#39;integer&#39; and &#39;limit&#39;.
Definition: ApiBase.php:106
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:728
const PARAM_ALLOW_DUPLICATES
(boolean) Allow the same value to be set more than once when PARAM_ISMULTI is true?
Definition: ApiBase.php:109