Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php |
— | — | @@ -173,9 +173,12 @@ |
174 | 174 | } |
175 | 175 | |
176 | 176 | public function updateFilterCounts( $pageId, $filters, $decrement ) { |
177 | | - $dbw = wfGetDB( DB_MASTER ); |
| 177 | + // Don't do anything unless we have filters to process. |
| 178 | + if( !$filters ) { return; } |
| 179 | + if( !count( $filters ) ) { return; } |
178 | 180 | |
179 | | - $dbw->begin(); |
| 181 | + $dbw = wfGetDB( DB_MASTER ); |
| 182 | + $dbw->begin(); |
180 | 183 | |
181 | 184 | foreach ( $filters as $filter ) { |
182 | 185 | $rows[] = array( |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php |
— | — | @@ -55,17 +55,15 @@ |
56 | 56 | /** |
57 | 57 | * Pulls a rollup row |
58 | 58 | * |
59 | | - * @param $pageId int the page id |
60 | | - * @param $revisionLimit int go back only to this revision |
61 | | - * @param $type string the type of row to fetch ('page' or 'revision') |
62 | | - * @return array the rollup rows |
| 59 | + * @param $pageId int the page id |
| 60 | + * @return array the rollup rows |
63 | 61 | */ |
64 | | - private function fetchRollup( $pageId, $revisionLimit, $type ) { |
65 | | - $dbr = wfGetDB( DB_SLAVE ); |
66 | | - $where = array(); |
67 | | - $table = 'article_feedback_ratings_rollup'; |
68 | | - $where['arr_page_id'] = $pageId; |
| 62 | + private function fetchRollup( $pageId ) { |
| 63 | + $dbr = wfGetDB( DB_SLAVE ); |
| 64 | + $where = array(); |
69 | 65 | $where[] = 'arr_field_id = afi_id'; |
| 66 | + $where['arr_page_id'] = $pageId; |
| 67 | + |
70 | 68 | $rows = $dbr->select( |
71 | 69 | array( |
72 | 70 | 'aft_article_feedback_ratings_rollup', |