r110950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110949‎ | r110950 | r110951 >
Date:19:26, 8 February 2012
Author:gregchiasson
Status:ok
Tags:aft, nodeploy 
Comment:
AFT5 - silence a couple of PHP warnings by 1. not doing anything with filters when there aren't any to update, and 2. Fix the fetchRollup function to not require two extra argument that it wasn't even using.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php
@@ -173,9 +173,12 @@
174174 }
175175
176176 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; }
178180
179 - $dbw->begin();
 181+ $dbw = wfGetDB( DB_MASTER );
 182+ $dbw->begin();
180183
181184 foreach ( $filters as $filter ) {
182185 $rows[] = array(
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewRatingsArticleFeedbackv5.php
@@ -55,17 +55,15 @@
5656 /**
5757 * Pulls a rollup row
5858 *
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
6361 */
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();
6965 $where[] = 'arr_field_id = afi_id';
 66+ $where['arr_page_id'] = $pageId;
 67+
7068 $rows = $dbr->select(
7169 array(
7270 'aft_article_feedback_ratings_rollup',

Status & tagging log