Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php |
— | — | @@ -44,10 +44,6 @@ |
45 | 45 | |
46 | 46 | parent::execute(); |
47 | 47 | } |
48 | | - |
49 | | - function getSpecializedWhereClause() { |
50 | | - return array( 'cr_author' => $this->mAuthor ); |
51 | | - } |
52 | 48 | } |
53 | 49 | |
54 | 50 | class SvnRevAuthorTablePager extends SvnRevTablePager { |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -187,6 +187,9 @@ |
188 | 188 | return $ret; |
189 | 189 | } |
190 | 190 | |
| 191 | + /** |
| 192 | + * @return SvnRevTablePager |
| 193 | + */ |
191 | 194 | function getPager() { |
192 | 195 | return new SvnRevTablePager( $this ); |
193 | 196 | } |
— | — | @@ -194,25 +197,21 @@ |
195 | 198 | /** |
196 | 199 | * Get total number of revisions for this revision view |
197 | 200 | * |
| 201 | + * @var $dbr DatabaseBase |
198 | 202 | * @return int Number of revisions |
199 | 203 | */ |
200 | 204 | function getRevCount( $dbr ) { |
201 | | - $tables = array( 'code_rev' ); |
202 | | - $selectFields = array( 'COUNT( DISTINCT cr_id ) AS rev_count' ); |
203 | | - // Count if code_rev where path matches |
204 | | - if ( strlen( $this->mPath ) ) { |
205 | | - $tables[] = 'code_paths'; |
206 | | - $whereCond = array( |
207 | | - 'cr_repo_id' => $this->mRepo->getId(), |
208 | | - 'cr_id = cp_rev_id', |
209 | | - 'cp_path' => $this->mPath, |
210 | | - ); |
211 | | - } else { |
212 | | - // No path; count of code_rev |
213 | | - $whereCond = array( 'cr_repo_id' => $this->mRepo->getId() ); |
214 | | - } |
215 | | - $whereCond = array_merge( $whereCond, $this->getSpecializedWhereClause( $dbr ) ); |
216 | | - $result = $dbr->selectRow( $tables, $selectFields, $whereCond ); |
| 205 | + $query = $this->getPager()->getCountQuery(); |
| 206 | + |
| 207 | + $query['conds'] = array_merge( $query['conds'], $this->getSpecializedWhereClause() ); |
| 208 | + |
| 209 | + $result = $dbr->selectRow( $query['tables'], |
| 210 | + $query['fields'], |
| 211 | + $query['conds'], |
| 212 | + __METHOD__, |
| 213 | + $query['options'], |
| 214 | + $query['join_conds'] |
| 215 | + ); |
217 | 216 | if ( $result ) { |
218 | 217 | return intval( $result->rev_count ); |
219 | 218 | } else { |
— | — | @@ -220,13 +219,6 @@ |
221 | 220 | } |
222 | 221 | } |
223 | 222 | |
224 | | - /** |
225 | | - * @todo Document |
226 | | - */ |
227 | | - function getSpecializedWhereClause() { |
228 | | - return array(); |
229 | | - } |
230 | | - |
231 | 223 | function getRepo() { |
232 | 224 | return $this->mRepo; |
233 | 225 | } |
— | — | @@ -278,6 +270,14 @@ |
279 | 271 | return $query; |
280 | 272 | } |
281 | 273 | |
| 274 | + function getCountQuery() { |
| 275 | + $query = $this->getQueryInfo(); |
| 276 | + |
| 277 | + $query['fields'] = array( 'COUNT( DISTINCT cr_id ) AS rev_count' ); |
| 278 | + unset( $query['options']['GROUP BY'] ); |
| 279 | + return $query; |
| 280 | + } |
| 281 | + |
282 | 282 | function getSelectFields() { |
283 | 283 | return array_unique( |
284 | 284 | array( $this->getDefaultSort(), |
Index: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php |
— | — | @@ -10,10 +10,6 @@ |
11 | 11 | function getPager() { |
12 | 12 | return new SvnRevStatusTablePager( $this, $this->mStatus ); |
13 | 13 | } |
14 | | - |
15 | | - function getSpecializedWhereClause() { |
16 | | - return array( 'cr_status' => $this->mStatus ); |
17 | | - } |
18 | 14 | } |
19 | 15 | |
20 | 16 | class SvnRevStatusTablePager extends SvnRevTablePager { |