https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106239

Revision: 106239
Author:   kaldari
Date:     2011-12-14 20:08:57 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
follow-up to r105659, only connect to db when necessary, use better condition 
statement

Modified Paths:
--------------
    trunk/extensions/ContributionReporting/ContributionReporting.php

Modified: trunk/extensions/ContributionReporting/ContributionReporting.php
===================================================================
--- trunk/extensions/ContributionReporting/ContributionReporting.php    
2011-12-14 20:04:11 UTC (rev 106238)
+++ trunk/extensions/ContributionReporting/ContributionReporting.php    
2011-12-14 20:08:57 UTC (rev 106239)
@@ -214,8 +214,6 @@
 function efContributionReportingTotal( $fundraiser, $fudgeFactor = 0 ) {
        global $wgMemc, $egFundraiserStatisticsFundraisers, 
$egFundraiserStatisticsCacheTimeout;
 
-       $dbr = efContributionReportingConnection();
-       
        // If a total is cached, use that
        $key = wfMemcKey( 'contributionreportingtotal', $fundraiser, 
$fudgeFactor );
        $cache = $wgMemc->get( $key );
@@ -223,6 +221,8 @@
                return $cache;
        }
        
+       $dbr = efContributionReportingConnection();
+       
        // Find the index number for the requested fundraiser
        $myFundraiserIndex = false;
        foreach ( $egFundraiserStatisticsFundraisers as $fundraiserIndex => 
$fundraiserArray ) {
@@ -242,7 +242,7 @@
        $result = $dbr->select(
                'public_reporting_fundraisers',
                'round( prf_total ) AS total',
-               'prf_id = ' . $myFundraiser['id'],
+               'prf_id' => $myFundraiser['id'],
                __METHOD__
        );
        $row = $dbr->fetchRow( $result );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to