ApiParamInfo.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <?php
  2. /**
  3. * Copyright © 2008 Roan Kattouw "<Firstname>.<Lastname>@gmail.com"
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. * http://www.gnu.org/copyleft/gpl.html
  19. *
  20. * @file
  21. */
  22. /**
  23. * @ingroup API
  24. */
  25. class ApiParamInfo extends ApiBase {
  26. private $helpFormat;
  27. private $context;
  28. public function __construct( ApiMain $main, $action ) {
  29. parent::__construct( $main, $action );
  30. }
  31. public function execute() {
  32. // Get parameters
  33. $params = $this->extractRequestParams();
  34. $this->helpFormat = $params['helpformat'];
  35. $this->context = new RequestContext;
  36. $this->context->setUser( new User ); // anon to avoid caching issues
  37. $this->context->setLanguage( $this->getMain()->getLanguage() );
  38. if ( is_array( $params['modules'] ) ) {
  39. $modules = [];
  40. foreach ( $params['modules'] as $path ) {
  41. if ( $path === '*' || $path === '**' ) {
  42. $path = "main+$path";
  43. }
  44. if ( substr( $path, -2 ) === '+*' || substr( $path, -2 ) === ' *' ) {
  45. $submodules = true;
  46. $path = substr( $path, 0, -2 );
  47. $recursive = false;
  48. } elseif ( substr( $path, -3 ) === '+**' || substr( $path, -3 ) === ' **' ) {
  49. $submodules = true;
  50. $path = substr( $path, 0, -3 );
  51. $recursive = true;
  52. } else {
  53. $submodules = false;
  54. }
  55. if ( $submodules ) {
  56. try {
  57. $module = $this->getModuleFromPath( $path );
  58. } catch ( ApiUsageException $ex ) {
  59. foreach ( $ex->getStatusValue()->getErrors() as $error ) {
  60. $this->addWarning( $error );
  61. }
  62. continue;
  63. }
  64. $submodules = $this->listAllSubmodules( $module, $recursive );
  65. if ( $submodules ) {
  66. $modules = array_merge( $modules, $submodules );
  67. } else {
  68. $this->addWarning( [ 'apierror-badmodule-nosubmodules', $path ], 'badmodule' );
  69. }
  70. } else {
  71. $modules[] = $path;
  72. }
  73. }
  74. } else {
  75. $modules = [];
  76. }
  77. if ( is_array( $params['querymodules'] ) ) {
  78. $queryModules = $params['querymodules'];
  79. foreach ( $queryModules as $m ) {
  80. $modules[] = 'query+' . $m;
  81. }
  82. } else {
  83. $queryModules = [];
  84. }
  85. if ( is_array( $params['formatmodules'] ) ) {
  86. $formatModules = $params['formatmodules'];
  87. foreach ( $formatModules as $m ) {
  88. $modules[] = $m;
  89. }
  90. } else {
  91. $formatModules = [];
  92. }
  93. $modules = array_unique( $modules );
  94. $res = [];
  95. foreach ( $modules as $m ) {
  96. try {
  97. $module = $this->getModuleFromPath( $m );
  98. } catch ( ApiUsageException $ex ) {
  99. foreach ( $ex->getStatusValue()->getErrors() as $error ) {
  100. $this->addWarning( $error );
  101. }
  102. continue;
  103. }
  104. $key = 'modules';
  105. // Back compat
  106. $isBCQuery = false;
  107. if ( $module->getParent() && $module->getParent()->getModuleName() == 'query' &&
  108. in_array( $module->getModuleName(), $queryModules )
  109. ) {
  110. $isBCQuery = true;
  111. $key = 'querymodules';
  112. }
  113. if ( in_array( $module->getModuleName(), $formatModules ) ) {
  114. $key = 'formatmodules';
  115. }
  116. $item = $this->getModuleInfo( $module );
  117. if ( $isBCQuery ) {
  118. $item['querytype'] = $item['group'];
  119. }
  120. $res[$key][] = $item;
  121. }
  122. $result = $this->getResult();
  123. $result->addValue( [ $this->getModuleName() ], 'helpformat', $this->helpFormat );
  124. foreach ( $res as $key => $stuff ) {
  125. ApiResult::setIndexedTagName( $res[$key], 'module' );
  126. }
  127. if ( $params['mainmodule'] ) {
  128. $res['mainmodule'] = $this->getModuleInfo( $this->getMain() );
  129. }
  130. if ( $params['pagesetmodule'] ) {
  131. $pageSet = new ApiPageSet( $this->getMain()->getModuleManager()->getModule( 'query' ) );
  132. $res['pagesetmodule'] = $this->getModuleInfo( $pageSet );
  133. unset( $res['pagesetmodule']['name'] );
  134. unset( $res['pagesetmodule']['path'] );
  135. unset( $res['pagesetmodule']['group'] );
  136. }
  137. $result->addValue( null, $this->getModuleName(), $res );
  138. }
  139. /**
  140. * List all submodules of a module
  141. * @param ApiBase $module
  142. * @param bool $recursive
  143. * @return string[]
  144. */
  145. private function listAllSubmodules( ApiBase $module, $recursive ) {
  146. $manager = $module->getModuleManager();
  147. if ( $manager ) {
  148. $paths = [];
  149. $names = $manager->getNames();
  150. sort( $names );
  151. foreach ( $names as $name ) {
  152. $submodule = $manager->getModule( $name );
  153. $paths[] = $submodule->getModulePath();
  154. if ( $recursive && $submodule->getModuleManager() ) {
  155. $paths = array_merge( $paths, $this->listAllSubmodules( $submodule, $recursive ) );
  156. }
  157. }
  158. }
  159. return $paths;
  160. }
  161. /**
  162. * @param array &$res Result array
  163. * @param string $key Result key
  164. * @param Message[] $msgs
  165. * @param bool $joinLists
  166. */
  167. protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
  168. switch ( $this->helpFormat ) {
  169. case 'none':
  170. break;
  171. case 'wikitext':
  172. $ret = [];
  173. foreach ( $msgs as $m ) {
  174. $ret[] = $m->setContext( $this->context )->text();
  175. }
  176. $res[$key] = implode( "\n\n", $ret );
  177. if ( $joinLists ) {
  178. $res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] );
  179. }
  180. break;
  181. case 'html':
  182. $ret = [];
  183. foreach ( $msgs as $m ) {
  184. $ret[] = $m->setContext( $this->context )->parseAsBlock();
  185. }
  186. $ret = implode( "\n", $ret );
  187. if ( $joinLists ) {
  188. $ret = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $ret );
  189. }
  190. $res[$key] = Parser::stripOuterParagraph( $ret );
  191. break;
  192. case 'raw':
  193. $res[$key] = [];
  194. foreach ( $msgs as $m ) {
  195. $a = [
  196. 'key' => $m->getKey(),
  197. 'params' => $m->getParams(),
  198. ];
  199. ApiResult::setIndexedTagName( $a['params'], 'param' );
  200. if ( $m instanceof ApiHelpParamValueMessage ) {
  201. $a['forvalue'] = $m->getParamValue();
  202. }
  203. $res[$key][] = $a;
  204. }
  205. ApiResult::setIndexedTagName( $res[$key], 'msg' );
  206. break;
  207. }
  208. }
  209. /**
  210. * @param ApiBase $module
  211. * @return array
  212. */
  213. private function getModuleInfo( $module ) {
  214. $ret = [];
  215. $path = $module->getModulePath();
  216. $ret['name'] = $module->getModuleName();
  217. $ret['classname'] = get_class( $module );
  218. $ret['path'] = $path;
  219. if ( !$module->isMain() ) {
  220. $ret['group'] = $module->getParent()->getModuleManager()->getModuleGroup(
  221. $module->getModuleName()
  222. );
  223. }
  224. $ret['prefix'] = $module->getModulePrefix();
  225. $sourceInfo = $module->getModuleSourceInfo();
  226. if ( $sourceInfo ) {
  227. $ret['source'] = $sourceInfo['name'];
  228. if ( isset( $sourceInfo['namemsg'] ) ) {
  229. $ret['sourcename'] = $this->context->msg( $sourceInfo['namemsg'] )->text();
  230. } else {
  231. $ret['sourcename'] = $ret['source'];
  232. }
  233. $link = SpecialPage::getTitleFor( 'Version', 'License/' . $sourceInfo['name'] )->getFullURL();
  234. if ( isset( $sourceInfo['license-name'] ) ) {
  235. $ret['licensetag'] = $sourceInfo['license-name'];
  236. $ret['licenselink'] = (string)$link;
  237. } elseif ( SpecialVersion::getExtLicenseFileName( dirname( $sourceInfo['path'] ) ) ) {
  238. $ret['licenselink'] = (string)$link;
  239. }
  240. }
  241. $this->formatHelpMessages( $ret, 'description', $module->getFinalDescription() );
  242. foreach ( $module->getHelpFlags() as $flag ) {
  243. $ret[$flag] = true;
  244. }
  245. $ret['helpurls'] = (array)$module->getHelpUrls();
  246. if ( isset( $ret['helpurls'][0] ) && $ret['helpurls'][0] === false ) {
  247. $ret['helpurls'] = [];
  248. }
  249. ApiResult::setIndexedTagName( $ret['helpurls'], 'helpurl' );
  250. if ( $this->helpFormat !== 'none' ) {
  251. $ret['examples'] = [];
  252. $examples = $module->getExamplesMessages();
  253. foreach ( $examples as $qs => $msg ) {
  254. $item = [
  255. 'query' => $qs
  256. ];
  257. $msg = ApiBase::makeMessage( $msg, $this->context, [
  258. $module->getModulePrefix(),
  259. $module->getModuleName(),
  260. $module->getModulePath()
  261. ] );
  262. $this->formatHelpMessages( $item, 'description', [ $msg ] );
  263. if ( isset( $item['description'] ) ) {
  264. if ( is_array( $item['description'] ) ) {
  265. $item['description'] = $item['description'][0];
  266. } else {
  267. ApiResult::setSubelementsList( $item, 'description' );
  268. }
  269. }
  270. $ret['examples'][] = $item;
  271. }
  272. ApiResult::setIndexedTagName( $ret['examples'], 'example' );
  273. }
  274. $ret['parameters'] = [];
  275. $ret['templatedparameters'] = [];
  276. $params = $module->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
  277. $paramDesc = $module->getFinalParamDescription();
  278. $index = 0;
  279. foreach ( $params as $name => $settings ) {
  280. if ( !is_array( $settings ) ) {
  281. $settings = [ ApiBase::PARAM_DFLT => $settings ];
  282. }
  283. $item = [
  284. 'index' => ++$index,
  285. 'name' => $name,
  286. ];
  287. if ( !empty( $settings[ApiBase::PARAM_TEMPLATE_VARS] ) ) {
  288. $item['templatevars'] = $settings[ApiBase::PARAM_TEMPLATE_VARS];
  289. ApiResult::setIndexedTagName( $item['templatevars'], 'var' );
  290. }
  291. if ( isset( $paramDesc[$name] ) ) {
  292. $this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
  293. }
  294. $item['required'] = !empty( $settings[ApiBase::PARAM_REQUIRED] );
  295. if ( !empty( $settings[ApiBase::PARAM_DEPRECATED] ) ) {
  296. $item['deprecated'] = true;
  297. }
  298. if ( $name === 'token' && $module->needsToken() ) {
  299. $item['tokentype'] = $module->needsToken();
  300. }
  301. if ( !isset( $settings[ApiBase::PARAM_TYPE] ) ) {
  302. $dflt = $settings[ApiBase::PARAM_DFLT] ?? null;
  303. if ( is_bool( $dflt ) ) {
  304. $settings[ApiBase::PARAM_TYPE] = 'boolean';
  305. } elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
  306. $settings[ApiBase::PARAM_TYPE] = 'string';
  307. } elseif ( is_int( $dflt ) ) {
  308. $settings[ApiBase::PARAM_TYPE] = 'integer';
  309. }
  310. }
  311. if ( isset( $settings[ApiBase::PARAM_DFLT] ) ) {
  312. switch ( $settings[ApiBase::PARAM_TYPE] ) {
  313. case 'boolean':
  314. $item['default'] = (bool)$settings[ApiBase::PARAM_DFLT];
  315. break;
  316. case 'string':
  317. case 'text':
  318. case 'password':
  319. $item['default'] = strval( $settings[ApiBase::PARAM_DFLT] );
  320. break;
  321. case 'integer':
  322. case 'limit':
  323. $item['default'] = (int)$settings[ApiBase::PARAM_DFLT];
  324. break;
  325. case 'timestamp':
  326. $item['default'] = wfTimestamp( TS_ISO_8601, $settings[ApiBase::PARAM_DFLT] );
  327. break;
  328. default:
  329. $item['default'] = $settings[ApiBase::PARAM_DFLT];
  330. break;
  331. }
  332. }
  333. $item['multi'] = !empty( $settings[ApiBase::PARAM_ISMULTI] );
  334. if ( $item['multi'] ) {
  335. $item['lowlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT1] )
  336. ? $settings[ApiBase::PARAM_ISMULTI_LIMIT1]
  337. : ApiBase::LIMIT_SML1;
  338. $item['highlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT2] )
  339. ? $settings[ApiBase::PARAM_ISMULTI_LIMIT2]
  340. : ApiBase::LIMIT_SML2;
  341. $item['limit'] = $this->getMain()->canApiHighLimits()
  342. ? $item['highlimit']
  343. : $item['lowlimit'];
  344. }
  345. if ( !empty( $settings[ApiBase::PARAM_ALLOW_DUPLICATES] ) ) {
  346. $item['allowsduplicates'] = true;
  347. }
  348. if ( isset( $settings[ApiBase::PARAM_TYPE] ) ) {
  349. if ( $settings[ApiBase::PARAM_TYPE] === 'submodule' ) {
  350. if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
  351. ksort( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
  352. $item['type'] = array_keys( $settings[ApiBase::PARAM_SUBMODULE_MAP] );
  353. $item['submodules'] = $settings[ApiBase::PARAM_SUBMODULE_MAP];
  354. } else {
  355. $item['type'] = $module->getModuleManager()->getNames( $name );
  356. sort( $item['type'] );
  357. $prefix = $module->isMain()
  358. ? '' : ( $module->getModulePath() . '+' );
  359. $item['submodules'] = [];
  360. foreach ( $item['type'] as $v ) {
  361. $item['submodules'][$v] = $prefix . $v;
  362. }
  363. }
  364. if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
  365. $item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
  366. }
  367. $deprecatedSubmodules = [];
  368. foreach ( $item['submodules'] as $v => $submodulePath ) {
  369. try {
  370. $submod = $this->getModuleFromPath( $submodulePath );
  371. if ( $submod && $submod->isDeprecated() ) {
  372. $deprecatedSubmodules[] = $v;
  373. }
  374. } catch ( ApiUsageException $ex ) {
  375. // Ignore
  376. }
  377. }
  378. if ( $deprecatedSubmodules ) {
  379. $item['type'] = array_merge(
  380. array_diff( $item['type'], $deprecatedSubmodules ),
  381. $deprecatedSubmodules
  382. );
  383. $item['deprecatedvalues'] = $deprecatedSubmodules;
  384. }
  385. } elseif ( $settings[ApiBase::PARAM_TYPE] === 'tags' ) {
  386. $item['type'] = ChangeTags::listExplicitlyDefinedTags();
  387. } else {
  388. $item['type'] = $settings[ApiBase::PARAM_TYPE];
  389. }
  390. if ( is_array( $item['type'] ) ) {
  391. // To prevent sparse arrays from being serialized to JSON as objects
  392. $item['type'] = array_values( $item['type'] );
  393. ApiResult::setIndexedTagName( $item['type'], 't' );
  394. }
  395. // Add 'allspecifier' if applicable
  396. if ( $item['type'] === 'namespace' ) {
  397. $allowAll = true;
  398. $allSpecifier = ApiBase::ALL_DEFAULT_STRING;
  399. } else {
  400. $allowAll = $settings[ApiBase::PARAM_ALL] ?? false;
  401. $allSpecifier = ( is_string( $allowAll ) ? $allowAll : ApiBase::ALL_DEFAULT_STRING );
  402. }
  403. if ( $allowAll && $item['multi'] &&
  404. ( is_array( $item['type'] ) || $item['type'] === 'namespace' ) ) {
  405. $item['allspecifier'] = $allSpecifier;
  406. }
  407. if ( $item['type'] === 'namespace' &&
  408. isset( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] ) &&
  409. is_array( $settings[ApiBase::PARAM_EXTRA_NAMESPACES] )
  410. ) {
  411. $item['extranamespaces'] = $settings[ApiBase::PARAM_EXTRA_NAMESPACES];
  412. ApiResult::setArrayType( $item['extranamespaces'], 'array' );
  413. ApiResult::setIndexedTagName( $item['extranamespaces'], 'ns' );
  414. }
  415. }
  416. if ( isset( $settings[ApiBase::PARAM_MAX] ) ) {
  417. $item['max'] = $settings[ApiBase::PARAM_MAX];
  418. }
  419. if ( isset( $settings[ApiBase::PARAM_MAX2] ) ) {
  420. $item['highmax'] = $settings[ApiBase::PARAM_MAX2];
  421. }
  422. if ( isset( $settings[ApiBase::PARAM_MIN] ) ) {
  423. $item['min'] = $settings[ApiBase::PARAM_MIN];
  424. }
  425. if ( !empty( $settings[ApiBase::PARAM_RANGE_ENFORCE] ) ) {
  426. $item['enforcerange'] = true;
  427. }
  428. if ( isset( $settings[self::PARAM_MAX_BYTES] ) ) {
  429. $item['maxbytes'] = $settings[self::PARAM_MAX_BYTES];
  430. }
  431. if ( isset( $settings[self::PARAM_MAX_CHARS] ) ) {
  432. $item['maxchars'] = $settings[self::PARAM_MAX_CHARS];
  433. }
  434. if ( !empty( $settings[ApiBase::PARAM_DEPRECATED_VALUES] ) ) {
  435. $deprecatedValues = array_keys( $settings[ApiBase::PARAM_DEPRECATED_VALUES] );
  436. if ( is_array( $item['type'] ) ) {
  437. $deprecatedValues = array_intersect( $deprecatedValues, $item['type'] );
  438. }
  439. if ( $deprecatedValues ) {
  440. $item['deprecatedvalues'] = array_values( $deprecatedValues );
  441. ApiResult::setIndexedTagName( $item['deprecatedvalues'], 'v' );
  442. }
  443. }
  444. if ( !empty( $settings[ApiBase::PARAM_HELP_MSG_INFO] ) ) {
  445. $item['info'] = [];
  446. foreach ( $settings[ApiBase::PARAM_HELP_MSG_INFO] as $i ) {
  447. $tag = array_shift( $i );
  448. $info = [
  449. 'name' => $tag,
  450. ];
  451. if ( count( $i ) ) {
  452. $info['values'] = $i;
  453. ApiResult::setIndexedTagName( $info['values'], 'v' );
  454. }
  455. $this->formatHelpMessages( $info, 'text', [
  456. $this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
  457. ->numParams( count( $i ) )
  458. ->params( $this->context->getLanguage()->commaList( $i ) )
  459. ->params( $module->getModulePrefix() )
  460. ] );
  461. ApiResult::setSubelementsList( $info, 'text' );
  462. $item['info'][] = $info;
  463. }
  464. ApiResult::setIndexedTagName( $item['info'], 'i' );
  465. }
  466. $key = empty( $settings[ApiBase::PARAM_TEMPLATE_VARS] ) ? 'parameters' : 'templatedparameters';
  467. $ret[$key][] = $item;
  468. }
  469. ApiResult::setIndexedTagName( $ret['parameters'], 'param' );
  470. ApiResult::setIndexedTagName( $ret['templatedparameters'], 'param' );
  471. $dynamicParams = $module->dynamicParameterDocumentation();
  472. if ( $dynamicParams !== null ) {
  473. if ( $this->helpFormat === 'none' ) {
  474. $ret['dynamicparameters'] = true;
  475. } else {
  476. $dynamicParams = ApiBase::makeMessage( $dynamicParams, $this->context, [
  477. $module->getModulePrefix(),
  478. $module->getModuleName(),
  479. $module->getModulePath()
  480. ] );
  481. $this->formatHelpMessages( $ret, 'dynamicparameters', [ $dynamicParams ] );
  482. }
  483. }
  484. return $ret;
  485. }
  486. public function isReadMode() {
  487. return false;
  488. }
  489. public function getAllowedParams() {
  490. // back compat
  491. $querymodules = $this->getMain()->getModuleManager()
  492. ->getModule( 'query' )->getModuleManager()->getNames();
  493. sort( $querymodules );
  494. $formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
  495. sort( $formatmodules );
  496. return [
  497. 'modules' => [
  498. ApiBase::PARAM_ISMULTI => true,
  499. ],
  500. 'helpformat' => [
  501. ApiBase::PARAM_DFLT => 'none',
  502. ApiBase::PARAM_TYPE => [ 'html', 'wikitext', 'raw', 'none' ],
  503. ],
  504. 'querymodules' => [
  505. ApiBase::PARAM_DEPRECATED => true,
  506. ApiBase::PARAM_ISMULTI => true,
  507. ApiBase::PARAM_TYPE => $querymodules,
  508. ],
  509. 'mainmodule' => [
  510. ApiBase::PARAM_DEPRECATED => true,
  511. ],
  512. 'pagesetmodule' => [
  513. ApiBase::PARAM_DEPRECATED => true,
  514. ],
  515. 'formatmodules' => [
  516. ApiBase::PARAM_DEPRECATED => true,
  517. ApiBase::PARAM_ISMULTI => true,
  518. ApiBase::PARAM_TYPE => $formatmodules,
  519. ]
  520. ];
  521. }
  522. protected function getExamplesMessages() {
  523. return [
  524. 'action=paraminfo&modules=parse|phpfm|query%2Ballpages|query%2Bsiteinfo'
  525. => 'apihelp-paraminfo-example-1',
  526. 'action=paraminfo&modules=query%2B*'
  527. => 'apihelp-paraminfo-example-2',
  528. ];
  529. }
  530. public function getHelpUrls() {
  531. return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Parameter_information';
  532. }
  533. }