Index: trunk/extensions/CodeReview/CodeReview.i18n.php |
— | — | @@ -77,6 +77,7 @@ |
78 | 78 | 'code-rev-diff-link' => 'diff', |
79 | 79 | 'code-rev-diff-too-large' => 'The diff is too large to display.', |
80 | 80 | 'code-rev-purge-link' => 'purge', |
| 81 | + 'code-rev-total' => 'Total number of results: ', |
81 | 82 | 'code-status-new' => 'new', |
82 | 83 | 'code-status-fixme' => 'fixme', |
83 | 84 | 'code-status-reverted' => 'reverted', |
Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php |
— | — | @@ -44,8 +44,8 @@ |
45 | 45 | parent::execute(); |
46 | 46 | } |
47 | 47 | |
48 | | - function getSpecializedWhereClause($dbr) { |
49 | | - return ' AND cr_author = ' . $dbr->addQuotes($this->mAuthor); |
| 48 | + function getSpecializedWhereClause( $dbr ) { |
| 49 | + return ' AND cr_author = ' . $dbr->addQuotes( $this->mAuthor ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php |
— | — | @@ -28,16 +28,15 @@ |
29 | 29 | $this->doBatchChange(); |
30 | 30 | return; |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | $this->showForm(); |
34 | 34 | |
35 | 35 | //get the total count across all pages |
36 | | - $dbr =& wfGetDB(DB_SLAVE); |
37 | | - $revCountRes = $this->getRevCountQuery($dbr); |
| 36 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 37 | + $revCountRes = $this->getRevCountQuery( $dbr ); |
38 | 38 | $revCount = 0; |
39 | | - if ($dbr->numRows($revCountRes) > 0){ |
40 | | - $row = $dbr->fetchObject($revCountRes); |
41 | | - $revCount = $row->rev_count; |
| 39 | + if ( $revCountRes !== false ) { |
| 40 | + $revCount = $revCountRes->rev_count; |
42 | 41 | } |
43 | 42 | |
44 | 43 | $pager = $this->getPager(); |
— | — | @@ -51,7 +50,7 @@ |
52 | 51 | $pager->getNavigationBar() . |
53 | 52 | $pager->getLimitForm() . |
54 | 53 | '</td><td style="padding-left: 2em;">' . |
55 | | - ' Total number of results: <span style="font-weight: bold;">' . $revCount . '</span>' . |
| 54 | + ' ' . wfMsgHtml( 'code-rev-total' ) . '<span style="font-weight: bold;">' . $revCount . '</span>' . |
56 | 55 | '</td></tr></table>' . |
57 | 56 | Xml::openElement( 'form', |
58 | 57 | array( 'action' => $pager->getTitle()->getLocalURL(), 'method' => 'post' ) |
— | — | @@ -161,29 +160,28 @@ |
162 | 161 | return new SvnRevTablePager( $this ); |
163 | 162 | } |
164 | 163 | |
165 | | - function getRevCountQuery($dbr) { |
166 | | - $sql = 'SELECT COUNT(cr_id) AS rev_count' . |
167 | | - ' FROM ' . $dbr->tableName('code_rev') . ' '; |
| 164 | + function getRevCountQuery( $dbr ) { |
| 165 | + $tables = array( $dbr->tableName( 'code_rev' ) ); |
| 166 | + $selectFields = array( 'COUNT( cr_id ) AS rev_count' ); |
168 | 167 | // count if code_rev where path matches |
169 | 168 | if ( $this->mPath ) { |
170 | | - $sql .= ' WHERE cr_id in' . |
171 | | - ' (SELECT cp_rev_id from code_paths' . |
172 | | - ' WHERE' . |
| 169 | + $whereCond = 'cr_id IN' . |
| 170 | + ' ( SELECT cp_rev_id FROM '. $dbr->tableName( 'code_paths' ) . ' WHERE' . |
173 | 171 | ' cp_repo_id = ' . $this->mRepo->getId(). ' AND' . |
174 | | - ' cp_path LIKE ' . $dbr->addQuotes( $this->mPath . '%') . ' AND' . |
| 172 | + ' cp_path LIKE ' . $dbr->addQuotes( $this->mPath . '%' ) . ' AND' . |
175 | 173 | // performance |
176 | | - ' cp_rev_id > ' . ($this->mRepo->getLastStoredRev() - 20000) . |
177 | | - $this->getSpecializedWhereClause($dbr) . |
178 | | - ')'; |
| 174 | + ' cp_rev_id > ' . ( $this->mRepo->getLastStoredRev() - 20000 ) . |
| 175 | + $this->getSpecializedWhereClause( $dbr ) . |
| 176 | + ' )'; |
179 | 177 | // No path; count of code_rev |
180 | 178 | } else { |
181 | | - $sql .= ' WHERE cr_repo_id = ' . $this->mRepo->getId() . |
182 | | - $this->getSpecializedWhereClause($dbr); |
| 179 | + $whereCond = 'cr_repo_id = ' . $this->mRepo->getId() . |
| 180 | + $this->getSpecializedWhereClause( $dbr ); |
183 | 181 | } |
184 | | - return $dbr->query($sql); |
| 182 | + return $dbr->selectRow ($tables, $selectFields, $whereCond); |
185 | 183 | } |
186 | 184 | |
187 | | - function getSpecializedWhereClause($dbr) { |
| 185 | + function getSpecializedWhereClause( $dbr ) { |
188 | 186 | return ''; |
189 | 187 | } |
190 | 188 | |
Index: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php |
— | — | @@ -10,8 +10,8 @@ |
11 | 11 | return new SvnRevStatusTablePager( $this, $this->mStatus ); |
12 | 12 | } |
13 | 13 | |
14 | | - function getSpecializedWhereClause($dbr) { |
15 | | - return ' AND cr_status = ' . $dbr->addQuotes($this->mStatus); |
| 14 | + function getSpecializedWhereClause( $dbr ) { |
| 15 | + return ' AND cr_status = ' . $dbr->addQuotes( $this->mStatus ); |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |