39 const MAX_EXECUTE_SECONDS = 2.0;
55 parent::__construct( $queryModule, $moduleName,
'li' );
61 if ( $this->microtimeFunction ) {
62 return ( $this->microtimeFunction )();
69 $endTime = $this->
microtime() + self::MAX_EXECUTE_SECONDS;
72 $includeCode = isset( $props[
'code'] );
73 $includeBcp47 = isset( $props[
'bcp47'] );
74 $includeDir = isset( $props[
'dir'] );
75 $includeAutonym = isset( $props[
'autonym'] );
76 $includeName = isset( $props[
'name'] );
77 $includeFallbacks = isset( $props[
'fallbacks'] );
78 $includeVariants = isset( $props[
'variants'] );
80 $targetLanguageCode = $this->
getLanguage()->getCode();
92 if ( $selectedLanguageCodes === [
'*' ] ) {
93 $languageCodes = $availableLanguageCodes;
95 $languageCodes = array_values( array_intersect(
96 $availableLanguageCodes,
97 $selectedLanguageCodes
99 $unrecognizedCodes = array_values( array_diff(
100 $selectedLanguageCodes,
101 $availableLanguageCodes
103 if ( $unrecognizedCodes !== [] ) {
105 'apiwarn-unrecognizedvalues',
107 Message::listParam( $unrecognizedCodes,
'comma' ),
108 count( $unrecognizedCodes ),
116 if ( $continue ===
null ) {
117 $continue = reset( $languageCodes );
125 $result->addArrayType( $rootPath,
'assoc' );
127 foreach ( $languageCodes as $languageCode ) {
128 if ( $languageCode < $continue ) {
133 if ( $now >= $endTime ) {
141 if ( $includeCode ) {
142 $info[
'code'] = $languageCode;
145 if ( $includeBcp47 ) {
147 $info[
'bcp47'] = $bcp47;
155 if ( $includeAutonym ) {
161 $info[
'autonym'] = $autonym;
164 if ( $includeName ) {
170 $info[
'name'] = $name;
173 if ( $includeFallbacks ) {
180 $info[
'fallbacks'] = $fallbacks;
183 if ( $includeVariants ) {
186 $info[
'variants'] = $variants;
189 $fit = $result->addValue( $rootPath, $languageCode, $info );
204 self::PARAM_DFLT =>
'code',
205 self::PARAM_ISMULTI =>
true,
206 self::PARAM_TYPE => [
215 self::PARAM_HELP_MSG_PER_VALUE => [],
218 self::PARAM_DFLT =>
'*',
219 self::PARAM_ISMULTI =>
true,
222 self::PARAM_HELP_MSG =>
'api-help-param-continue',
228 $pathUrl =
'action=' . $this->
getQuery()->getModuleName() .
235 =>
"apihelp-$pathMsg-example-simple",
236 "$pathUrl&{$prefix}prop=autonym|name&uselang=de"
237 =>
"apihelp-$pathMsg-example-autonym-name-de",
238 "$pathUrl&{$prefix}prop=fallbacks|variants&{$prefix}code=oc"
239 =>
"apihelp-$pathMsg-example-fallbacks-variants-oc",
240 "$pathUrl&{$prefix}prop=bcp47|dir"
241 =>
"apihelp-$pathMsg-example-bcp47-dir",