r73469 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73468‎ | r73469 | r73470 >
Date:18:53, 21 September 2010
Author:catrope
Status:deferred
Tags:
Comment:
1.16wmf4: Merging PARAM_REQUIRED support from trunk for upcoming ArticleAssessment deployment. Merges changes to ApiBase.php only from r70460, r70461, r70462, r70477, r70479, r70554
Modified paths:
  • /branches/wmf/1.16wmf4/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/api/ApiBase.php
@@ -50,6 +50,7 @@
5151 const PARAM_MIN = 5; // Lowest value allowed for a parameter. Only applies if TYPE='integer'
5252 const PARAM_ALLOW_DUPLICATES = 6; // Boolean, do we allow the same value to be set more than once when ISMULTI=true
5353 const PARAM_DEPRECATED = 7; // Boolean, is the parameter deprecated (will show a warning)
 54+ const PARAM_REQUIRED = 8; // Boolean, is the parameter required?
5455
5556 const LIMIT_BIG1 = 500; // Fast query, std user limit
5657 const LIMIT_BIG2 = 5000; // Fast query, bot/sysop limit
@@ -300,6 +301,12 @@
301302 if ( $deprecated ) {
302303 $desc = "DEPRECATED! $desc";
303304 }
 305+
 306+ $required = isset( $paramSettings[self::PARAM_REQUIRED] ) ?
 307+ $paramSettings[self::PARAM_REQUIRED] : false;
 308+ if ( $required ) {
 309+ $desc .= $paramPrefix . "This parameter is required";
 310+ }
304311
305312 $type = isset( $paramSettings[self::PARAM_TYPE] ) ? $paramSettings[self::PARAM_TYPE] : null;
306313 if ( isset( $type ) ) {
@@ -565,6 +572,7 @@
566573 $type = isset( $paramSettings[self::PARAM_TYPE] ) ? $paramSettings[self::PARAM_TYPE] : null;
567574 $dupes = isset( $paramSettings[self::PARAM_ALLOW_DUPLICATES] ) ? $paramSettings[self::PARAM_ALLOW_DUPLICATES] : false;
568575 $deprecated = isset( $paramSettings[self::PARAM_DEPRECATED] ) ? $paramSettings[self::PARAM_DEPRECATED] : false;
 576+ $required = isset( $paramSettings[self::PARAM_REQUIRED] ) ? $paramSettings[self::PARAM_REQUIRED] : false;
569577
570578 // When type is not given, and no choices, the type is the same as $default
571579 if ( !isset( $type ) ) {
@@ -672,6 +680,8 @@
673681 if ( $deprecated && $value !== false ) {
674682 $this->setWarning( "The $encParamName parameter has been deprecated." );
675683 }
 684+ } else if ( $required ) {
 685+ $this->dieUsageMsg( array( 'missingparam', $paramName ) );
676686 }
677687
678688 return $value;
Property changes on: branches/wmf/1.16wmf4/includes/api/ApiBase.php
___________________________________________________________________
Modified: svn:mergeinfo
679689 Merged /trunk/phase3/includes/api/ApiBase.php:r70460-70462,70477,70479,70554

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70460* PARAM_REQUIRED parameter flag added. If this flag is set, and the end user ...soxred9313:35, 4 August 2010
r70461Followup to r70460: Committed wrong version of ApiBase.php, convert all core ...soxred9314:15, 4 August 2010
r70462Followup to r70460 and r70461: Use true instead of 1soxred9314:29, 4 August 2010
r70477Followup r70460/r70461...reedy20:27, 4 August 2010
r70479Further followup to r70460/r70461 and r70477...reedy21:19, 4 August 2010
r70554Followup r70460 per Umherirrender comment...reedy11:18, 6 August 2010

Status & tagging log