Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -496,10 +496,6 @@ |
497 | 497 | foreach ( $params as $paramName => $paramSettings ) { |
498 | 498 | $results[$paramName] = $this->getParameterFromSettings( |
499 | 499 | $paramName, $paramSettings, $parseLimit ); |
500 | | - |
501 | | - if( isset( $paramSettings[self::PARAM_REQUIRED] ) && !isset( $results[$paramName] ) ) { |
502 | | - $this->dieUsageMsg( array( 'missingparam', $paramName ) ); |
503 | | - } |
504 | 500 | } |
505 | 501 | } |
506 | 502 | $this->mParamCache[$parseLimit] = $results; |
— | — | @@ -627,6 +623,7 @@ |
628 | 624 | $type = isset( $paramSettings[self::PARAM_TYPE] ) ? $paramSettings[self::PARAM_TYPE] : null; |
629 | 625 | $dupes = isset( $paramSettings[self::PARAM_ALLOW_DUPLICATES] ) ? $paramSettings[self::PARAM_ALLOW_DUPLICATES] : false; |
630 | 626 | $deprecated = isset( $paramSettings[self::PARAM_DEPRECATED] ) ? $paramSettings[self::PARAM_DEPRECATED] : false; |
| 627 | + $required = isset( $paramSettings[self::PARAM_REQUIRED] ) ? $paramSettings[self::PARAM_REQUIRED] : false; |
631 | 628 | |
632 | 629 | // When type is not given, and no choices, the type is the same as $default |
633 | 630 | if ( !isset( $type ) ) { |
— | — | @@ -745,6 +742,8 @@ |
746 | 743 | if ( $deprecated && $value !== false ) { |
747 | 744 | $this->setWarning( "The $encParamName parameter has been deprecated." ); |
748 | 745 | } |
| 746 | + } else if ( $required ) { |
| 747 | + $this->dieUsageMsg( array( 'missingparam', $paramName ) ); |
749 | 748 | } |
750 | 749 | |
751 | 750 | return $value; |