r71503 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71502‎ | r71503 | r71504 >
Date:19:13, 23 August 2010
Author:reedy
Status:resolved
Tags:
Comment:
Mmmmm PARAM_REQUIRED goodness
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiCodeComments.php (modified) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeDiff.php (modified) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeRevisions.php (modified) (history)
  • /trunk/extensions/CodeReview/api/ApiCodeUpdate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/api/ApiCodeComments.php
@@ -35,9 +35,7 @@
3636 $this->dieUsage( 'You don\'t have permission to view code comments', 'permissiondenied' );
3737 }
3838 $params = $this->extractRequestParams();
39 - if ( is_null( $params['repo'] ) ) {
40 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
41 - }
 39+
4240 $this->props = array_flip( $params['prop'] );
4341 if ( isset( $this->props['revision'] ) ) {
4442 $this->setWarning( 'ccprop=revision has been deprecated in favor of ccprop=status' );
@@ -102,7 +100,10 @@
103101
104102 public function getAllowedParams() {
105103 return array(
106 - 'repo' => null,
 104+ 'repo' => array(
 105+ ApiBase::PARAM_TYPE => 'string',
 106+ ApiBase::PARAM_REQUIRED => true,
 107+ ),
107108 'limit' => array(
108109 ApiBase::PARAM_DFLT => 10,
109110 ApiBase::PARAM_TYPE => 'limit',
Index: trunk/extensions/CodeReview/api/ApiCodeDiff.php
@@ -10,13 +10,6 @@
1111 }
1212 $params = $this->extractRequestParams();
1313
14 - if ( !isset( $params['repo'] ) ) {
15 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
16 - }
17 - if ( !isset( $params['rev'] ) ) {
18 - $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
19 - }
20 -
2114 $repo = CodeRepository::newFromName( $params['repo'] );
2215 if ( !$repo ) {
2316 $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
@@ -50,10 +43,14 @@
5144
5245 public function getAllowedParams() {
5346 return array(
54 - 'repo' => null,
 47+ 'repo' => array(
 48+ ApiBase::PARAM_TYPE => 'string',
 49+ ApiBase::PARAM_REQUIRED => true,
 50+ ),
5551 'rev' => array(
5652 ApiBase::PARAM_TYPE => 'integer',
57 - ApiBase::PARAM_MIN => 1
 53+ ApiBase::PARAM_MIN => 1,
 54+ ApiBase::PARAM_REQUIRED => true,
5855 )
5956 );
6057 }
Index: trunk/extensions/CodeReview/api/ApiCodeRevisions.php
@@ -37,9 +37,7 @@
3838 $this->dieUsage( 'You don\'t have permission to view code revisions', 'permissiondenied' );
3939 }
4040 $params = $this->extractRequestParams();
41 - if ( is_null( $params['repo'] ) ) {
42 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
43 - }
 41+
4442 $this->props = array_flip( $params['prop'] );
4543
4644 $listview = new CodeRevisionListView( $params['repo'] );
@@ -108,7 +106,10 @@
109107
110108 public function getAllowedParams() {
111109 return array(
112 - 'repo' => null,
 110+ 'repo' => array(
 111+ ApiBase::PARAM_TYPE => 'string',
 112+ ApiBase::PARAM_REQUIRED => true,
 113+ ),
113114 'limit' => array(
114115 ApiBase::PARAM_DFLT => 10,
115116 ApiBase::PARAM_TYPE => 'limit',
Index: trunk/extensions/CodeReview/api/ApiCodeUpdate.php
@@ -10,13 +10,6 @@
1111 }
1212 $params = $this->extractRequestParams();
1313
14 - if ( !isset( $params['repo'] ) ) {
15 - $this->dieUsageMsg( array( 'missingparam', 'repo' ) );
16 - }
17 - if ( !isset( $params['rev'] ) ) {
18 - $this->dieUsageMsg( array( 'missingparam', 'rev' ) );
19 - }
20 -
2114 $repo = CodeRepository::newFromName( $params['repo'] );
2215 if ( !$repo ) {
2316 $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' );
@@ -75,10 +68,14 @@
7669
7770 public function getAllowedParams() {
7871 return array(
79 - 'repo' => null,
 72+ 'repo' => => array(
 73+ ApiBase::PARAM_TYPE => 'string',
 74+ ApiBase::PARAM_REQUIRED => true,
 75+ ),
8076 'rev' => array(
8177 ApiBase::PARAM_TYPE => 'integer',
82 - ApiBase::PARAM_MIN => 1
 78+ ApiBase::PARAM_MIN => 1,
 79+ ApiBase::PARAM_REQUIRED => true,
8380 )
8481 );
8582 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r71510Fix fail from r71503reedy20:46, 23 August 2010

Status & tagging log