Merge "Move around "ا" to after "آ" and not before"
[lhc/web/wiklou.git] / includes / api / ApiParamInfo.php
index 3be743d..2fa20a9 100644 (file)
@@ -163,7 +163,7 @@ class ApiParamInfo extends ApiBase {
        /**
         * List all submodules of a module
         * @param ApiBase $module
-        * @param boolean $recursive
+        * @param bool $recursive
         * @return string[]
         */
        private function listAllSubmodules( ApiBase $module, $recursive ) {
@@ -184,7 +184,7 @@ class ApiParamInfo extends ApiBase {
        }
 
        /**
-        * @param array $res Result array
+        * @param array &$res Result array
         * @param string $key Result key
         * @param Message[] $msgs
         * @param bool $joinLists
@@ -371,11 +371,15 @@ class ApiParamInfo extends ApiBase {
 
                        $item['multi'] = !empty( $settings[ApiBase::PARAM_ISMULTI] );
                        if ( $item['multi'] ) {
-                               $item['limit'] = $this->getMain()->canApiHighLimits() ?
-                                       ApiBase::LIMIT_SML2 :
-                                       ApiBase::LIMIT_SML1;
-                               $item['lowlimit'] = ApiBase::LIMIT_SML1;
-                               $item['highlimit'] = ApiBase::LIMIT_SML2;
+                               $item['lowlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT1] )
+                                       ? $settings[ApiBase::PARAM_ISMULTI_LIMIT1]
+                                       : ApiBase::LIMIT_SML1;
+                               $item['highlimit'] = !empty( $settings[ApiBase::PARAM_ISMULTI_LIMIT2] )
+                                       ? $settings[ApiBase::PARAM_ISMULTI_LIMIT2]
+                                       : ApiBase::LIMIT_SML2;
+                               $item['limit'] = $this->getMain()->canApiHighLimits()
+                                       ? $item['highlimit']
+                                       : $item['lowlimit'];
                        }
 
                        if ( !empty( $settings[ApiBase::PARAM_ALLOW_DUPLICATES] ) ) {
@@ -401,6 +405,25 @@ class ApiParamInfo extends ApiBase {
                                        if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
                                                $item['submoduleparamprefix'] = $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX];
                                        }
+
+                                       $deprecatedSubmodules = [];
+                                       foreach ( $item['submodules'] as $v => $submodulePath ) {
+                                               try {
+                                                       $submod = $this->getModuleFromPath( $submodulePath );
+                                                       if ( $submod && $submod->isDeprecated() ) {
+                                                               $deprecatedSubmodules[] = $v;
+                                                       }
+                                               } catch ( ApiUsageException $ex ) {
+                                                       // Ignore
+                                               }
+                                       }
+                                       if ( $deprecatedSubmodules ) {
+                                               $item['type'] = array_merge(
+                                                       array_diff( $item['type'], $deprecatedSubmodules ),
+                                                       $deprecatedSubmodules
+                                               );
+                                               $item['deprecatedvalues'] = $deprecatedSubmodules;
+                                       }
                                } elseif ( $settings[ApiBase::PARAM_TYPE] === 'tags' ) {
                                        $item['type'] = ChangeTags::listExplicitlyDefinedTags();
                                } else {