* (bug 27479) API error when using both prop=pageprops and prop=info&inprop=displaytitle
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index 4637c93..babaf78 100644 (file)
@@ -336,7 +336,9 @@ abstract class ApiBase {
                                                                $choices[] =  $t;
                                                        }
                                                }
-                                               $desc .= $paramPrefix . $nothingPrompt . $prompt . implode( ', ', $choices );
+                                               $desc .= $paramPrefix . $nothingPrompt . $prompt;
+                                               $choicesstring = implode( ', ', $choices );
+                                               $desc .= wordwrap( $choicesstring, 100, "\n                       " );
                                        } else {
                                                switch ( $type ) {
                                                        case 'namespace':
@@ -371,7 +373,7 @@ abstract class ApiBase {
                                                        $isArray = is_array( $paramSettings[self::PARAM_TYPE] );
 
                                                        if ( !$isArray
-                                                                       || $isArray && count( $paramSettings[self::PARAM_TYPE] ) > self::LIMIT_SML1) {
+                                                                       || $isArray && count( $paramSettings[self::PARAM_TYPE] ) > self::LIMIT_SML1 ) {
                                                                $desc .= $paramPrefix . "Maximum number of values " .
                                                                        self::LIMIT_SML1 . " (" . self::LIMIT_SML2 . " for bots)";
                                                        }
@@ -705,15 +707,17 @@ abstract class ApiBase {
                                                                ? $paramSettings[self::PARAM_RANGE_ENFORCE] : false;
 
                                                if ( !is_null( $min ) || !is_null( $max ) ) {
-                                                   if ( is_array( $value ) ) {
-                                                           $value = array_map( 'intval', $value );
-                                                           foreach ( $value as &$v ) {
+                                                       if ( is_array( $value ) ) {
+                                                               $value = array_map( 'intval', $value );
+                                                               foreach ( $value as &$v ) {
                                                                        $this->validateLimit( $paramName, $v, $min, $max, null, $enforceLimits );
                                                                }
-                                                   } else {
-                                                           $value = intval( $value );
-                                                           $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits );
-                                                   }
+                                                       } else {
+                                                               $value = intval( $value );
+                                                               $this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits );
+                                                       }
+                                               } else {
+                                                       $value = intval( $value );
                                                }
                                                break;
                                        case 'limit':
@@ -845,8 +849,8 @@ abstract class ApiBase {
         * Prints usage info on failure.
         * @param $paramName string Parameter name
         * @param $value int Parameter value
-        * @param $min int Minimum value
-        * @param $max int Maximum value for users
+        * @param $min int|null Minimum value
+        * @param $max int|null Maximum value for users
         * @param $botMax int Maximum value for sysops/bots
         * @param $enforceLimits Boolean Whether to enforce (die) if value is outside limits
         */
@@ -1038,6 +1042,7 @@ abstract class ApiBase {
                'sharedfile-exists' => array( 'code' => 'fileexists-sharedrepo-perm', 'info' => 'The target file exists on a shared repository. Use the ignorewarnings parameter to override it.' ),
                'mustbeposted' => array( 'code' => 'mustbeposted', 'info' => "The \$1 module requires a POST request" ),
                'show' => array( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ),
+               'specialpage-cantexecute' => array( 'code' => 'specialpage-cantexecute', 'info' => "You don't have permission to view the results of this special page" ),
 
                // ApiEditPage messages
                'noimageredirect-anon' => array( 'code' => 'noimageredirect-anon', 'info' => "Anonymous users can't create image redirects" ),