API: Remove useless PARAM_REQUIRED = false
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 15 Mar 2013 15:35:51 +0000 (16:35 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 15 Mar 2013 15:35:51 +0000 (16:35 +0100)
Also fix the condition in getPossibleErrors to avoid reporting of:
<error code="nosectiontitle" info="The sectiontitle parameter must be
set" />

Change-Id: Ifd808a040590ddffc0527da5ef0cc8cacdd008d9

includes/api/ApiBase.php
includes/api/ApiEditPage.php

index ee6f2c0..9351a8d 100644 (file)
@@ -1568,7 +1568,7 @@ abstract class ApiBase extends ContextSource {
                $params = $this->getFinalParams();
                if ( $params ) {
                        foreach ( $params as $paramName => $paramSettings ) {
-                               if ( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) ) {
+                               if ( isset( $paramSettings[ApiBase::PARAM_REQUIRED] ) && $paramSettings[ApiBase::PARAM_REQUIRED] ) {
                                        $ret[] = array( 'missingparam', $paramName );
                                }
                        }
index cba3489..4916145 100644 (file)
@@ -496,7 +496,6 @@ class ApiEditPage extends ApiBase {
                        'section' => null,
                        'sectiontitle' => array(
                                ApiBase::PARAM_TYPE => 'string',
-                               ApiBase::PARAM_REQUIRED => false,
                        ),
                        'text' => null,
                        'token' => array(