Index: trunk/extensions/ReaderFeedback/ReaderFeedback.class.php |
— | — | @@ -88,10 +88,10 @@ |
89 | 89 | */ |
90 | 90 | public static function getAverageRating( $article, $tag, $forUpdate=false ) { |
91 | 91 | global $wgFeedbackAge; |
| 92 | + $db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
92 | 93 | $cutoff_unixtime = time() - $wgFeedbackAge; |
93 | 94 | // rfh_date is always MW format on all dbms |
94 | 95 | $encCutoff = $db->addQuotes( wfTimestamp( TS_MW, $cutoff_unixtime ) ); |
95 | | - $db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
96 | 96 | $row = $db->selectRow( 'reader_feedback_history', |
97 | 97 | array('SUM(rfh_total)/SUM(rfh_count) AS ave, SUM(rfh_count) AS count'), |
98 | 98 | array( 'rfh_page_id' => $article->getId(), 'rfh_tag' => $tag, |