Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -244,8 +244,9 @@ |
245 | 245 | } |
246 | 246 | |
247 | 247 | function getQueryInfo() { |
| 248 | + $defaultSort = $this->getDefaultSort(); |
248 | 249 | // Path-based query... |
249 | | - if ( $this->getDefaultSort() === 'cp_rev_id' ) { |
| 250 | + if ( $defaultSort === 'cp_rev_id' ) { |
250 | 251 | $query = array( |
251 | 252 | 'tables' => array( 'code_paths', 'code_rev', 'code_comment' ), |
252 | 253 | 'fields' => $this->getSelectFields(), |
— | — | @@ -255,7 +256,7 @@ |
256 | 257 | // performance |
257 | 258 | 'cp_rev_id > ' . $this->mRepo->getPathSearchHorizon() |
258 | 259 | ), |
259 | | - 'options' => array( 'GROUP BY' => 'cp_rev_id', 'USE INDEX' => array( 'code_path' => 'cp_repo_id' ) ), |
| 260 | + 'options' => array( 'GROUP BY' => $defaultSort, 'USE INDEX' => array( 'code_path' => 'cp_repo_id' ) ), |
260 | 261 | 'join_conds' => array( |
261 | 262 | 'code_rev' => array( 'INNER JOIN', 'cr_repo_id = cp_repo_id AND cr_id = cp_rev_id' ), |
262 | 263 | 'code_comment' => array( 'LEFT JOIN', 'cc_repo_id = cp_repo_id AND cc_rev_id = cp_rev_id' ), |
— | — | @@ -267,7 +268,7 @@ |
268 | 269 | 'tables' => array( 'code_rev', 'code_comment' ), |
269 | 270 | 'fields' => $this->getSelectFields(), |
270 | 271 | 'conds' => array( 'cr_repo_id' => $this->mRepo->getId() ), |
271 | | - 'options' => array( 'GROUP BY' => 'cr_id' ), |
| 272 | + 'options' => array( 'GROUP BY' => $defaultSort ), |
272 | 273 | 'join_conds' => array( |
273 | 274 | 'code_comment' => array( 'LEFT JOIN', 'cc_repo_id = cr_repo_id AND cc_rev_id = cr_id' ), |
274 | 275 | ) |
Index: trunk/extensions/CodeReview/ui/CodeRevisionTagView.php |
— | — | @@ -17,6 +17,10 @@ |
18 | 18 | $this->mTag = $tag; |
19 | 19 | } |
20 | 20 | |
| 21 | + function getDefaultSort() { |
| 22 | + return strlen( $this->mView->mPath ) ? 'cp_rev_id' : 'ct_rev_id'; |
| 23 | + } |
| 24 | + |
21 | 25 | function getQueryInfo() { |
22 | 26 | $info = parent::getQueryInfo(); |
23 | 27 | //Don't change table order, see http://www.mediawiki.org/wiki/Special:Code/MediaWiki/77733 |