3 use MediaWiki\MediaWikiServices
;
4 use Wikimedia\TestingAccessWrapper
;
7 * Checks that all API modules, core and extensions, conform to the conventions:
8 * - have documentation i18n messages (the test won't catch everything since
9 * i18n messages can vary based on the wiki configuration, but it should
10 * catch many cases for forgotten i18n)
11 * - do not have inconsistencies in the parameter definitions
16 class ApiStructureTest
extends MediaWikiTestCase
{
21 /** @var array Sets of globals to test. Each array element is input to HashConfig */
22 private static $testGlobals = [
32 * Values are an array, where each array value is a permitted type. A type
33 * can be a string, which is the name of an internal type or a
34 * class/interface. Or it can be an array, in which case the value must be
35 * an array whose elements are the types given in the array (e.g., [
36 * 'string', integer' ] means an array whose entries are strings and/or
39 private static $paramTypes = [
40 // ApiBase::PARAM_DFLT => as appropriate for PARAM_TYPE
41 ApiBase
::PARAM_ISMULTI
=> [ 'boolean' ],
42 ApiBase
::PARAM_TYPE
=> [ 'string', [ 'string' ] ],
43 ApiBase
::PARAM_MAX
=> [ 'integer' ],
44 ApiBase
::PARAM_MAX2
=> [ 'integer' ],
45 ApiBase
::PARAM_MIN
=> [ 'integer' ],
46 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ 'boolean' ],
47 ApiBase
::PARAM_DEPRECATED
=> [ 'boolean' ],
48 ApiBase
::PARAM_REQUIRED
=> [ 'boolean' ],
49 ApiBase
::PARAM_RANGE_ENFORCE
=> [ 'boolean' ],
50 ApiBase
::PARAM_HELP_MSG
=> [ 'string', 'array', Message
::class ],
51 ApiBase
::PARAM_HELP_MSG_APPEND
=> [ [ 'string', 'array', Message
::class ] ],
52 ApiBase
::PARAM_HELP_MSG_INFO
=> [ [ 'array' ] ],
53 ApiBase
::PARAM_VALUE_LINKS
=> [ [ 'string' ] ],
54 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> [ [ 'string', 'array', Message
::class ] ],
55 ApiBase
::PARAM_SUBMODULE_MAP
=> [ [ 'string' ] ],
56 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> [ 'string' ],
57 ApiBase
::PARAM_ALL
=> [ 'boolean', 'string' ],
58 ApiBase
::PARAM_EXTRA_NAMESPACES
=> [ [ 'integer' ] ],
59 ApiBase
::PARAM_SENSITIVE
=> [ 'boolean' ],
60 ApiBase
::PARAM_DEPRECATED_VALUES
=> [ 'array' ],
61 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [ 'integer' ],
62 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [ 'integer' ],
63 ApiBase
::PARAM_MAX_BYTES
=> [ 'integer' ],
64 ApiBase
::PARAM_MAX_CHARS
=> [ 'integer' ],
65 ApiBase
::PARAM_TEMPLATE_VARS
=> [ 'array' ],
68 // param => [ other param that must be present => required value or null ]
69 private static $paramRequirements = [
70 ApiBase
::PARAM_ALLOW_DUPLICATES
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
71 ApiBase
::PARAM_ALL
=> [ ApiBase
::PARAM_ISMULTI
=> true ],
72 ApiBase
::PARAM_ISMULTI_LIMIT1
=> [
73 ApiBase
::PARAM_ISMULTI
=> true,
74 ApiBase
::PARAM_ISMULTI_LIMIT2
=> null,
76 ApiBase
::PARAM_ISMULTI_LIMIT2
=> [
77 ApiBase
::PARAM_ISMULTI
=> true,
78 ApiBase
::PARAM_ISMULTI_LIMIT1
=> null,
82 // param => type(s) allowed for this param ('array' is any array)
83 private static $paramAllowedTypes = [
84 ApiBase
::PARAM_MAX
=> [ 'integer', 'limit' ],
85 ApiBase
::PARAM_MAX2
=> 'limit',
86 ApiBase
::PARAM_MIN
=> [ 'integer', 'limit' ],
87 ApiBase
::PARAM_RANGE_ENFORCE
=> 'integer',
88 ApiBase
::PARAM_VALUE_LINKS
=> 'array',
89 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> 'array',
90 ApiBase
::PARAM_SUBMODULE_MAP
=> 'submodule',
91 ApiBase
::PARAM_SUBMODULE_PARAM_PREFIX
=> 'submodule',
92 ApiBase
::PARAM_ALL
=> 'array',
93 ApiBase
::PARAM_EXTRA_NAMESPACES
=> 'namespace',
94 ApiBase
::PARAM_DEPRECATED_VALUES
=> 'array',
95 ApiBase
::PARAM_MAX_BYTES
=> [ 'NULL', 'string', 'text', 'password' ],
96 ApiBase
::PARAM_MAX_CHARS
=> [ 'NULL', 'string', 'text', 'password' ],
99 private static $paramProhibitedTypes = [
100 ApiBase
::PARAM_ISMULTI
=> [ 'boolean', 'limit', 'upload' ],
101 ApiBase
::PARAM_ALL
=> 'namespace',
102 ApiBase
::PARAM_SENSITIVE
=> 'password',
105 private static $constantNames = null;
108 * Initialize/fetch the ApiMain instance for testing
111 private static function getMain() {
112 if ( !self
::$main ) {
113 self
::$main = new ApiMain( RequestContext
::getMain() );
114 self
::$main->getContext()->setLanguage( 'en' );
115 self
::$main->getContext()->setTitle(
116 Title
::makeTitle( NS_SPECIAL
, 'Badtitle/dummy title for ApiStructureTest' )
124 * @param Message $msg
125 * @param string $what Which message is being checked
127 private function checkMessage( $msg, $what ) {
128 $msg = ApiBase
::makeMessage( $msg, self
::getMain()->getContext() );
129 $this->assertInstanceOf( Message
::class, $msg, "$what message" );
130 $this->assertTrue( $msg->exists(), "$what message {$msg->getKey()} exists" );
134 * @dataProvider provideDocumentationExists
135 * @param string $path Module path
136 * @param array $globals Globals to set
138 public function testDocumentationExists( $path, array $globals ) {
139 $main = self
::getMain();
141 // Set configuration variables
142 $main->getContext()->setConfig( new MultiConfig( [
143 new HashConfig( $globals ),
144 RequestContext
::getMain()->getConfig(),
146 foreach ( $globals as $k => $v ) {
147 $this->setMwGlobals( "wg$k", $v );
151 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
153 // Test messages for flags.
154 foreach ( $module->getHelpFlags() as $flag ) {
155 $this->checkMessage( "api-help-flag-$flag", "Flag $flag" );
158 // Module description messages.
159 $this->checkMessage( $module->getSummaryMessage(), 'Module summary' );
160 $this->checkMessage( $module->getExtendedDescription(), 'Module help top text' );
162 // Parameters. Lots of messages in here.
163 $params = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
165 foreach ( $params as $name => $settings ) {
166 if ( !is_array( $settings ) ) {
170 // Basic description message
171 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG
] ) ) {
172 $msg = $settings[ApiBase
::PARAM_HELP_MSG
];
174 $msg = "apihelp-{$path}-param-{$name}";
176 $this->checkMessage( $msg, "Parameter $name description" );
178 // If param-per-value is in use, each value's message
179 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
] ) ) {
180 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
],
181 "Parameter $name PARAM_HELP_MSG_PER_VALUE is array" );
182 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_TYPE
],
183 "Parameter $name PARAM_TYPE is array for msg-per-value mode" );
184 $valueMsgs = $settings[ApiBase
::PARAM_HELP_MSG_PER_VALUE
];
185 foreach ( $settings[ApiBase
::PARAM_TYPE
] as $value ) {
186 if ( isset( $valueMsgs[$value] ) ) {
187 $msg = $valueMsgs[$value];
189 $msg = "apihelp-{$path}-paramvalue-{$name}-{$value}";
191 $this->checkMessage( $msg, "Parameter $name value $value" );
195 // Appended messages (e.g. "disabled in miser mode")
196 if ( isset( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] ) ) {
197 $this->assertInternalType( 'array', $settings[ApiBase
::PARAM_HELP_MSG_APPEND
],
198 "Parameter $name PARAM_HELP_MSG_APPEND is array" );
199 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_APPEND
] as $i => $msg ) {
200 $this->checkMessage( $msg, "Parameter $name HELP_MSG_APPEND #$i" );
204 // Info tags (e.g. "only usable in mode 1") are typically shared by
205 // several parameters, so accumulate them and test them later.
206 if ( !empty( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] ) ) {
207 foreach ( $settings[ApiBase
::PARAM_HELP_MSG_INFO
] as $i ) {
208 $tags[array_shift( $i )] = 1;
213 // Info tags (e.g. "only usable in mode 1") accumulated above
214 foreach ( $tags as $tag => $dummy ) {
215 $this->checkMessage( "apihelp-{$path}-paraminfo-{$tag}", "HELP_MSG_INFO tag $tag" );
218 // Messages for examples.
219 foreach ( $module->getExamplesMessages() as $qs => $msg ) {
220 $this->assertStringStartsNotWith( 'api.php?', $qs,
221 "Query string must not begin with 'api.php?'" );
222 $this->checkMessage( $msg, "Example $qs" );
226 public static function provideDocumentationExists() {
227 $main = self
::getMain();
228 $paths = self
::getSubModulePaths( $main->getModuleManager() );
229 array_unshift( $paths, $main->getModulePath() );
232 foreach ( $paths as $path ) {
233 foreach ( self
::$testGlobals as $globals ) {
235 foreach ( $globals as $k => $v ) {
236 $g[] = "$k=" . var_export( $v, 1 );
238 $k = "Module $path with " . implode( ', ', $g );
239 $ret[$k] = [ $path, $globals ];
246 * @dataProvider provideParameterConsistency
247 * @param string $path
249 public function testParameterConsistency( $path ) {
250 $main = self
::getMain();
251 $module = TestingAccessWrapper
::newFromObject( $main->getModuleFromPath( $path ) );
253 $paramsPlain = $module->getFinalParams();
254 $paramsForHelp = $module->getFinalParams( ApiBase
::GET_VALUES_FOR_HELP
);
256 // avoid warnings about empty tests when no parameter needs to be checked
257 $this->assertTrue( true );
259 if ( self
::$constantNames === null ) {
260 self
::$constantNames = [];
262 foreach ( ( new ReflectionClass( 'ApiBase' ) )->getConstants() as $key => $val ) {
263 if ( substr( $key, 0, 6 ) === 'PARAM_' ) {
264 self
::$constantNames[$val] = $key;
269 foreach ( [ $paramsPlain, $paramsForHelp ] as $params ) {
270 foreach ( $params as $param => $config ) {
271 if ( !is_array( $config ) ) {
272 $config = [ ApiBase
::PARAM_DFLT
=> $config ];
274 if ( !isset( $config[ApiBase
::PARAM_TYPE
] ) ) {
275 $config[ApiBase
::PARAM_TYPE
] = isset( $config[ApiBase
::PARAM_DFLT
] )
276 ?
gettype( $config[ApiBase
::PARAM_DFLT
] )
280 foreach ( self
::$paramTypes as $key => $types ) {
281 if ( !isset( $config[$key] ) ) {
284 $keyName = self
::$constantNames[$key];
285 $this->validateType( $types, $config[$key], $param, $keyName );
288 foreach ( self
::$paramRequirements as $key => $required ) {
289 if ( !isset( $config[$key] ) ) {
292 foreach ( $required as $requireKey => $requireVal ) {
293 $this->assertArrayHasKey( $requireKey, $config,
294 "$param: When " . self
::$constantNames[$key] . " is set, " .
295 self
::$constantNames[$requireKey] . " must also be set" );
296 if ( $requireVal !== null ) {
297 $this->assertSame( $requireVal, $config[$requireKey],
298 "$param: When " . self
::$constantNames[$key] . " is set, " .
299 self
::$constantNames[$requireKey] . " must equal " .
300 var_export( $requireVal, true ) );
305 foreach ( self
::$paramAllowedTypes as $key => $allowedTypes ) {
306 if ( !isset( $config[$key] ) ) {
310 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
311 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
313 $this->assertContains(
315 (array)$allowedTypes,
316 "$param: " . self
::$constantNames[$key] .
317 " can only be used with PARAM_TYPE " .
318 implode( ', ', (array)$allowedTypes )
322 foreach ( self
::$paramProhibitedTypes as $key => $prohibitedTypes ) {
323 if ( !isset( $config[$key] ) ) {
327 $actualType = is_array( $config[ApiBase
::PARAM_TYPE
] )
328 ?
'array' : $config[ApiBase
::PARAM_TYPE
];
330 $this->assertNotContains(
332 (array)$prohibitedTypes,
333 "$param: " . self
::$constantNames[$key] .
334 " cannot be used with PARAM_TYPE " .
335 implode( ', ', (array)$prohibitedTypes )
339 if ( isset( $config[ApiBase
::PARAM_DFLT
] ) ) {
341 isset( $config[ApiBase
::PARAM_REQUIRED
] ) &&
342 $config[ApiBase
::PARAM_REQUIRED
],
343 "$param: A required parameter cannot have a default" );
345 $this->validateDefault( $param, $config );
348 if ( $config[ApiBase
::PARAM_TYPE
] === 'limit' ) {
350 isset( $config[ApiBase
::PARAM_MAX
] ) &&
351 isset( $config[ApiBase
::PARAM_MAX2
] ),
352 "$param: PARAM_MAX and PARAM_MAX2 are required for limits"
354 $this->assertGreaterThanOrEqual(
355 $config[ApiBase
::PARAM_MAX
],
356 $config[ApiBase
::PARAM_MAX2
],
357 "$param: PARAM_MAX cannot be greater than PARAM_MAX2"
362 isset( $config[ApiBase
::PARAM_MIN
] ) &&
363 isset( $config[ApiBase
::PARAM_MAX
] )
365 $this->assertGreaterThanOrEqual(
366 $config[ApiBase
::PARAM_MIN
],
367 $config[ApiBase
::PARAM_MAX
],
368 "$param: PARAM_MIN cannot be greater than PARAM_MAX"
372 if ( isset( $config[ApiBase
::PARAM_RANGE_ENFORCE
] ) ) {
374 isset( $config[ApiBase
::PARAM_MIN
] ) ||
375 isset( $config[ApiBase
::PARAM_MAX
] ),
376 "$param: PARAM_RANGE_ENFORCE can only be set together with " .
377 "PARAM_MIN or PARAM_MAX"
381 if ( isset( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] ) ) {
382 foreach ( $config[ApiBase
::PARAM_DEPRECATED_VALUES
] as $key => $unused ) {
383 $this->assertContains( $key, $config[ApiBase
::PARAM_TYPE
],
384 "$param: Deprecated value \"$key\" is not allowed, " .
385 "how can it be deprecated?" );
390 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT1
] ) ||
391 isset( $config[ApiBase
::PARAM_ISMULTI_LIMIT2
] )
393 $this->assertGreaterThanOrEqual( 0, $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
394 "$param: PARAM_ISMULTI_LIMIT1 cannot be negative" );
395 // Zero for both doesn't make sense, but you could have
397 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
398 "$param: PARAM_ISMULTI_LIMIT2 cannot be negative or zero" );
399 $this->assertGreaterThanOrEqual(
400 $config[ApiBase
::PARAM_ISMULTI_LIMIT1
],
401 $config[ApiBase
::PARAM_ISMULTI_LIMIT2
],
402 "$param: PARAM_ISMULTI limit cannot be smaller for users with " .
403 "apihighlimits rights" );
406 if ( isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) ) {
407 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_BYTES
],
408 "$param: PARAM_MAX_BYTES cannot be negative or zero" );
411 if ( isset( $config[ApiBase
::PARAM_MAX_CHARS
] ) ) {
412 $this->assertGreaterThanOrEqual( 1, $config[ApiBase
::PARAM_MAX_CHARS
],
413 "$param: PARAM_MAX_CHARS cannot be negative or zero" );
417 isset( $config[ApiBase
::PARAM_MAX_BYTES
] ) &&
418 isset( $config[ApiBase
::PARAM_MAX_CHARS
] )
420 // Length of a string in chars is always <= length in bytes,
421 // so PARAM_MAX_CHARS is pointless if > PARAM_MAX_BYTES
422 $this->assertGreaterThanOrEqual(
423 $config[ApiBase
::PARAM_MAX_CHARS
],
424 $config[ApiBase
::PARAM_MAX_BYTES
],
425 "$param: PARAM_MAX_BYTES cannot be less than PARAM_MAX_CHARS"
429 if ( isset( $config[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
430 $this->assertNotSame( [], $config[ApiBase
::PARAM_TEMPLATE_VARS
],
431 "$param: PARAM_TEMPLATE_VARS cannot be empty" );
432 foreach ( $config[ApiBase
::PARAM_TEMPLATE_VARS
] as $key => $target ) {
433 $this->assertRegExp( '/^[^{}]+$/', $key,
434 "$param: PARAM_TEMPLATE_VARS key may not contain '{' or '}'" );
436 $this->assertContains( '{' . $key . '}', $param,
437 "$param: Name must contain PARAM_TEMPLATE_VARS key {" . $key . "}" );
438 $this->assertArrayHasKey( $target, $params,
439 "$param: PARAM_TEMPLATE_VARS target parameter '$target' does not exist" );
440 $config2 = $params[$target];
441 $this->assertTrue( !empty( $config2[ApiBase
::PARAM_ISMULTI
] ),
442 "$param: PARAM_TEMPLATE_VARS target parameter '$target' must have PARAM_ISMULTI = true" );
444 if ( isset( $config2[ApiBase
::PARAM_TEMPLATE_VARS
] ) ) {
445 $this->assertNotSame( $param, $target,
446 "$param: PARAM_TEMPLATE_VARS cannot target itself" );
448 $this->assertArraySubset(
449 $config2[ApiBase
::PARAM_TEMPLATE_VARS
],
450 $config[ApiBase
::PARAM_TEMPLATE_VARS
],
452 "$param: PARAM_TEMPLATE_VARS target parameter '$target': "
453 . "the target's PARAM_TEMPLATE_VARS must be a subset of the original."
458 $keys = implode( '|',
461 return preg_quote( $key, '/' );
463 array_keys( $config[ApiBase
::PARAM_TEMPLATE_VARS
] )
466 $this->assertRegExp( '/^(?>[^{}]+|\{(?:' . $keys . ')\})+$/', $param,
467 "$param: Name may not contain '{' or '}' other than as defined by PARAM_TEMPLATE_VARS" );
469 $this->assertRegExp( '/^[^{}]+$/', $param,
470 "$param: Name may not contain '{' or '}' without PARAM_TEMPLATE_VARS" );
477 * Throws if $value does not match one of the types specified in $types.
479 * @param array $types From self::$paramTypes array
480 * @param mixed $value Value to check
481 * @param string $param Name of param we're checking, for error messages
482 * @param string $desc Description for error messages
484 private function validateType( $types, $value, $param, $desc ) {
485 if ( count( $types ) === 1 ) {
486 // Only one type allowed
487 if ( is_string( $types[0] ) ) {
488 $this->assertType( $types[0], $value, "$param: $desc type" );
490 // Array whose values have specified types, recurse
491 $this->assertInternalType( 'array', $value, "$param: $desc type" );
492 foreach ( $value as $subvalue ) {
493 $this->validateType( $types[0], $subvalue, $param, "$desc value" );
498 foreach ( $types as $type ) {
499 if ( is_string( $type ) ) {
500 if ( class_exists( $type ) ||
interface_exists( $type ) ) {
501 if ( $value instanceof $type ) {
504 } elseif ( gettype( $value ) === $type ) {
508 // Array whose values have specified types, recurse
510 $this->validateType( [ $type ], $value, $param, "$desc type" );
511 // Didn't throw, so we're good
513 } catch ( Exception
$unused ) {
517 // Doesn't match any of them
518 $this->fail( "$param: $desc has incorrect type" );
523 * Asserts that $default is a valid default for $type.
525 * @param string $param Name of param, for error messages
526 * @param array $config Array of configuration options for this parameter
528 private function validateDefault( $param, $config ) {
529 $type = $config[ApiBase
::PARAM_TYPE
];
530 $default = $config[ApiBase
::PARAM_DFLT
];
532 if ( !empty( $config[ApiBase
::PARAM_ISMULTI
] ) ) {
533 if ( $default === '' ) {
534 // The empty array is fine
537 $defaults = explode( '|', $default );
538 $config[ApiBase
::PARAM_ISMULTI
] = false;
539 foreach ( $defaults as $defaultValue ) {
540 // Only allow integers in their simplest form with no leading
541 // or trailing characters etc.
542 if ( $type === 'integer' && $defaultValue === (string)(int)$defaultValue ) {
543 $defaultValue = (int)$defaultValue;
545 $config[ApiBase
::PARAM_DFLT
] = $defaultValue;
546 $this->validateDefault( $param, $config );
552 $this->assertFalse( $default,
553 "$param: Boolean params may only default to false" );
557 $this->assertInternalType( 'integer', $default,
558 "$param: Default $default is not an integer" );
562 if ( $default === 'max' ) {
565 $this->assertInternalType( 'integer', $default,
566 "$param: Default $default is neither an integer nor \"max\"" );
570 $validValues = MediaWikiServices
::getInstance()->getNamespaceInfo()->
571 getValidNamespaces();
573 isset( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] ) &&
574 is_array( $config[ApiBase
::PARAM_EXTRA_NAMESPACES
] )
576 $validValues = array_merge(
578 $config[ApiBase
::PARAM_EXTRA_NAMESPACES
]
581 $this->assertContains( $default, $validValues,
582 "$param: Default $default is not a valid namespace" );
591 $this->assertInternalType( 'string', $default,
592 "$param: Default $default is not a string" );
596 if ( $default === 'now' ) {
599 $this->assertNotFalse( wfTimestamp( TS_MW
, $default ),
600 "$param: Default $default is not a valid timestamp" );
604 // @todo Should we make user validation a public static method
605 // in ApiBase() or something so we don't have to resort to
606 // this? Or in User for that matter.
607 $wrapper = TestingAccessWrapper
::newFromObject( new ApiMain() );
609 $wrapper->validateUser( $default, '' );
610 } catch ( ApiUsageException
$e ) {
611 $this->fail( "$param: Default $default is not a valid username/IP address" );
616 if ( is_array( $type ) ) {
617 $this->assertContains( $default, $type,
618 "$param: Default $default is not any of " .
619 implode( ', ', $type ) );
621 $this->fail( "Unrecognized type $type" );
627 * @return array List of API module paths to test
629 public static function provideParameterConsistency() {
630 $main = self
::getMain();
631 $paths = self
::getSubModulePaths( $main->getModuleManager() );
632 array_unshift( $paths, $main->getModulePath() );
635 foreach ( $paths as $path ) {
642 * Return paths of all submodules in an ApiModuleManager, recursively
643 * @param ApiModuleManager $manager
646 protected static function getSubModulePaths( ApiModuleManager
$manager ) {
648 foreach ( $manager->getNames() as $name ) {
649 $module = $manager->getModule( $name );
650 $paths[] = $module->getModulePath();
651 $subManager = $module->getModuleManager();
653 $paths = array_merge( $paths, self
::getSubModulePaths( $subManager ) );