r106239 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106238‎ | r106239 | r106240 >
Date:20:08, 14 December 2011
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
follow-up to r105659, only connect to db when necessary, use better condition statement
Modified paths:
  • /trunk/extensions/ContributionReporting/ContributionReporting.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/ContributionReporting.php
@@ -214,8 +214,6 @@
215215 function efContributionReportingTotal( $fundraiser, $fudgeFactor = 0 ) {
216216 global $wgMemc, $egFundraiserStatisticsFundraisers, $egFundraiserStatisticsCacheTimeout;
217217
218 - $dbr = efContributionReportingConnection();
219 -
220218 // If a total is cached, use that
221219 $key = wfMemcKey( 'contributionreportingtotal', $fundraiser, $fudgeFactor );
222220 $cache = $wgMemc->get( $key );
@@ -223,6 +221,8 @@
224222 return $cache;
225223 }
226224
 225+ $dbr = efContributionReportingConnection();
 226+
227227 // Find the index number for the requested fundraiser
228228 $myFundraiserIndex = false;
229229 foreach ( $egFundraiserStatisticsFundraisers as $fundraiserIndex => $fundraiserArray ) {
@@ -242,7 +242,7 @@
243243 $result = $dbr->select(
244244 'public_reporting_fundraisers',
245245 'round( prf_total ) AS total',
246 - 'prf_id = ' . $myFundraiser['id'],
 246+ 'prf_id' => $myFundraiser['id'],
247247 __METHOD__
248248 );
249249 $row = $dbr->fetchRow( $result );

Follow-up revisions

RevisionCommit summaryAuthorDate
r106696MFT r105145, r105454, r105641, r105657, r105659, r105757, r105916, r105965, r...awjrichards20:59, 19 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105659make parserfunction based on fundraiser ID instead of start time, start using...kaldari08:04, 9 December 2011

Comments

#Comment by Awjrichards (talk | contribs)   02:59, 15 December 2011

Oops missed this the first time around:

 	$result = $dbr->select(
 		'public_reporting_fundraisers',
 		'round( prf_total ) AS total',
-		'prf_id = ' . $myFundraiser['id'],
+		'prf_id' => $myFundraiser['id'],
 		__METHOD__
 	);

Syntax error! Should be:

 	$result = $dbr->select(
 		'public_reporting_fundraisers',
 		'round( prf_total ) AS total',
		array(  'prf_id' => $myFundraiser['id'] ),
 		__METHOD__
 	);
#Comment by Awjrichards (talk | contribs)   03:03, 15 December 2011

oh you already fixed this in r106287

Status & tagging log