Index: trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php |
— | — | @@ -82,23 +82,23 @@ |
83 | 83 | $count = 0; |
84 | 84 | $start = 0; |
85 | 85 | $defaultSort = $pager->getDefaultSort(); |
| 86 | + $result = $this->getResult(); |
86 | 87 | foreach ( $revisions as $row ) { |
87 | 88 | if ( !$revsSet && $count == $limit ) { |
88 | 89 | $this->setContinueEnumParameter( 'start', $start ); |
89 | 90 | break; |
90 | 91 | } |
91 | 92 | |
92 | | - $data[] = $this->formatRow( $row ); |
| 93 | + $data[] = $this->formatRow( $row, $repo, $result ); |
93 | 94 | $start = $row->$defaultSort; |
94 | 95 | $count++; |
95 | 96 | } |
96 | 97 | |
97 | | - $result = $this->getResult(); |
98 | 98 | $result->setIndexedTagName( $data, 'revision' ); |
99 | 99 | $result->addValue( 'query', $this->getModuleName(), $data ); |
100 | 100 | } |
101 | 101 | |
102 | | - private function formatRow( $row ) { |
| 102 | + private function formatRow( $row, $repo, $result ) { |
103 | 103 | $item = array(); |
104 | 104 | if ( isset( $this->props['revid'] ) ) { |
105 | 105 | $item['revid'] = intval( $row->cr_id ); |
— | — | @@ -121,6 +121,11 @@ |
122 | 122 | if ( isset( $this->props['timestamp'] ) ) { |
123 | 123 | $item['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cr_timestamp ); |
124 | 124 | } |
| 125 | + if ( isset( $this->props['tags'] ) ) { |
| 126 | + $rev = CodeRevision::newFromRow( $repo, $row ); |
| 127 | + $item['tags'] = $rev->getTags( ); |
| 128 | + $result->setIndexedTagName( $item, 'tags' ); |
| 129 | + } |
125 | 130 | return $item; |
126 | 131 | } |
127 | 132 | |
— | — | @@ -156,6 +161,7 @@ |
157 | 162 | 'path', |
158 | 163 | 'message', |
159 | 164 | 'author', |
| 165 | + 'tags', |
160 | 166 | 'timestamp', |
161 | 167 | ), |
162 | 168 | ), |
— | — | @@ -188,7 +194,7 @@ |
189 | 195 | public function getExamples() { |
190 | 196 | return array( |
191 | 197 | 'api.php?action=query&list=coderevisions&crrepo=MediaWiki', |
192 | | - 'api.php?action=query&list=coderevisions&crrepo=MediaWiki&crprop=revid|author|status|timestamp', |
| 198 | + 'api.php?action=query&list=coderevisions&crrepo=MediaWiki&crprop=revid|author|status|timestamp|tags', |
193 | 199 | ); |
194 | 200 | } |
195 | 201 | |