"Catrope" changed the status of MediaWiki.r110098 to "fixme" and commented it.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/110098#c30281
Old Status: new
> New Status: fixme
Commit summary for MediaWiki.r110098:
AFT5 - Backend plumbing in FlagFeedback call to support toggle buttons and
decreasing counts/unflagging. Adds new parameter, 'direction', which controls
that (defaults to increase, which is the normal behavior)
Catrope's comment:
<pre>
+ // Re-fetch record - as above, from read/slave DB.
+ // The record could have had it's falg increased or
+ // decreased, so load a fresh (as fresh as the read
+ // db is, anyway) copy of it.
+ $record = $this->fetchRecord( $params['feedbackid'] );
+ if( $record->af_abuse_count > 5 ) {
</pre>
Why would you do that? Re-reading from the slave makes very little sense. You
either care about freshness, or you don't. If you do, load from the master, if
you don't, load from the slave once, not twice. Given that you're conditionally
issuing a query based on the outcome, you should read from the master, or --
even better -- put the condition in the WHERE clause of the UPDATE query.
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview