Index: trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php |
— | — | @@ -49,6 +49,10 @@ |
50 | 50 | $data = array(); |
51 | 51 | |
52 | 52 | $listview = new CodeRevisionListView( $repo ); |
| 53 | + if ( isset( $params['path'] ) && $params['path'] !== '' ) { |
| 54 | + $listview->mPath = CodeRevisionListView::pathsToArray( $params['path'] ); |
| 55 | + } |
| 56 | + |
53 | 57 | $pager = $listview->getPager(); |
54 | 58 | |
55 | 59 | $revsSet = count( $params['revs'] ); |
— | — | @@ -133,6 +137,7 @@ |
134 | 138 | ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, |
135 | 139 | ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 |
136 | 140 | ), |
| 141 | + 'path' => null, |
137 | 142 | 'start' => array( |
138 | 143 | ApiBase::PARAM_TYPE => 'integer' |
139 | 144 | ), |
— | — | @@ -162,6 +167,7 @@ |
163 | 168 | return array( |
164 | 169 | 'repo' => 'Name of the repository', |
165 | 170 | 'limit' => 'How many revisions to return', |
| 171 | + 'path' => 'Only show revisions in these path(s)', |
166 | 172 | 'start' => 'Timestamp to start listing at', |
167 | 173 | 'revs' => "List of revisions to get information about. Overrides {$p}start", |
168 | 174 | 'prop' => 'Which properties to return', |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | $path = $wgRequest->getVal( 'path' ); |
25 | 25 | |
26 | 26 | if ( $path != '' ) { |
27 | | - $this->mPath = array_map( array( $this, 'preparePaths' ), explode( '|', $path ) ); |
| 27 | + $this->mPath = self::pathsToArray( $path ); |
28 | 28 | } else { |
29 | 29 | $this->mPath = array(); |
30 | 30 | } |
— | — | @@ -47,10 +47,18 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | | - * @param string $path |
| 51 | + * @param $path string |
| 52 | + * @return array |
| 53 | + */ |
| 54 | + public static function pathsToArray( $path ) { |
| 55 | + return array_map( array( 'self', 'preparePaths' ), explode( '|', $path ) ); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * @param $path string |
52 | 60 | * @return string |
53 | 61 | */ |
54 | | - function preparePaths( $path ) { |
| 62 | + public static function preparePaths( $path ) { |
55 | 63 | $path = trim( $path ); |
56 | 64 | $path = rtrim( $path, '/' ); |
57 | 65 | $path = htmlspecialchars( $path ); |