Index: trunk/extensions/CodeReview/api/ApiCodeComments.php |
— | — | @@ -35,9 +35,7 @@ |
36 | 36 | $this->dieUsage( 'You don\'t have permission to view code comments', 'permissiondenied' ); |
37 | 37 | } |
38 | 38 | $params = $this->extractRequestParams(); |
39 | | - if ( is_null( $params['repo'] ) ) { |
40 | | - $this->dieUsageMsg( array( 'missingparam', 'repo' ) ); |
41 | | - } |
| 39 | + |
42 | 40 | $this->props = array_flip( $params['prop'] ); |
43 | 41 | if ( isset( $this->props['revision'] ) ) { |
44 | 42 | $this->setWarning( 'ccprop=revision has been deprecated in favor of ccprop=status' ); |
— | — | @@ -102,7 +100,10 @@ |
103 | 101 | |
104 | 102 | public function getAllowedParams() { |
105 | 103 | return array( |
106 | | - 'repo' => null, |
| 104 | + 'repo' => array( |
| 105 | + ApiBase::PARAM_TYPE => 'string', |
| 106 | + ApiBase::PARAM_REQUIRED => true, |
| 107 | + ), |
107 | 108 | 'limit' => array( |
108 | 109 | ApiBase::PARAM_DFLT => 10, |
109 | 110 | ApiBase::PARAM_TYPE => 'limit', |
Index: trunk/extensions/CodeReview/api/ApiCodeDiff.php |
— | — | @@ -10,13 +10,6 @@ |
11 | 11 | } |
12 | 12 | $params = $this->extractRequestParams(); |
13 | 13 | |
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 | | - |
21 | 14 | $repo = CodeRepository::newFromName( $params['repo'] ); |
22 | 15 | if ( !$repo ) { |
23 | 16 | $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' ); |
— | — | @@ -50,10 +43,14 @@ |
51 | 44 | |
52 | 45 | public function getAllowedParams() { |
53 | 46 | return array( |
54 | | - 'repo' => null, |
| 47 | + 'repo' => array( |
| 48 | + ApiBase::PARAM_TYPE => 'string', |
| 49 | + ApiBase::PARAM_REQUIRED => true, |
| 50 | + ), |
55 | 51 | 'rev' => array( |
56 | 52 | ApiBase::PARAM_TYPE => 'integer', |
57 | | - ApiBase::PARAM_MIN => 1 |
| 53 | + ApiBase::PARAM_MIN => 1, |
| 54 | + ApiBase::PARAM_REQUIRED => true, |
58 | 55 | ) |
59 | 56 | ); |
60 | 57 | } |
Index: trunk/extensions/CodeReview/api/ApiCodeRevisions.php |
— | — | @@ -37,9 +37,7 @@ |
38 | 38 | $this->dieUsage( 'You don\'t have permission to view code revisions', 'permissiondenied' ); |
39 | 39 | } |
40 | 40 | $params = $this->extractRequestParams(); |
41 | | - if ( is_null( $params['repo'] ) ) { |
42 | | - $this->dieUsageMsg( array( 'missingparam', 'repo' ) ); |
43 | | - } |
| 41 | + |
44 | 42 | $this->props = array_flip( $params['prop'] ); |
45 | 43 | |
46 | 44 | $listview = new CodeRevisionListView( $params['repo'] ); |
— | — | @@ -108,7 +106,10 @@ |
109 | 107 | |
110 | 108 | public function getAllowedParams() { |
111 | 109 | return array( |
112 | | - 'repo' => null, |
| 110 | + 'repo' => array( |
| 111 | + ApiBase::PARAM_TYPE => 'string', |
| 112 | + ApiBase::PARAM_REQUIRED => true, |
| 113 | + ), |
113 | 114 | 'limit' => array( |
114 | 115 | ApiBase::PARAM_DFLT => 10, |
115 | 116 | ApiBase::PARAM_TYPE => 'limit', |
Index: trunk/extensions/CodeReview/api/ApiCodeUpdate.php |
— | — | @@ -10,13 +10,6 @@ |
11 | 11 | } |
12 | 12 | $params = $this->extractRequestParams(); |
13 | 13 | |
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 | | - |
21 | 14 | $repo = CodeRepository::newFromName( $params['repo'] ); |
22 | 15 | if ( !$repo ) { |
23 | 16 | $this->dieUsage( "Invalid repo ``{$params['repo']}''", 'invalidrepo' ); |
— | — | @@ -75,10 +68,14 @@ |
76 | 69 | |
77 | 70 | public function getAllowedParams() { |
78 | 71 | return array( |
79 | | - 'repo' => null, |
| 72 | + 'repo' => => array( |
| 73 | + ApiBase::PARAM_TYPE => 'string', |
| 74 | + ApiBase::PARAM_REQUIRED => true, |
| 75 | + ), |
80 | 76 | 'rev' => array( |
81 | 77 | ApiBase::PARAM_TYPE => 'integer', |
82 | | - ApiBase::PARAM_MIN => 1 |
| 78 | + ApiBase::PARAM_MIN => 1, |
| 79 | + ApiBase::PARAM_REQUIRED => true, |
83 | 80 | ) |
84 | 81 | ); |
85 | 82 | } |