Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1212,7 +1212,9 @@ |
1213 | 1213 | public static function addToFileHistQuery( $file, &$tables, &$fields, &$conds, &$opts, &$join_conds ) { |
1214 | 1214 | if( $file->isLocal() ) { |
1215 | 1215 | $tables[] = 'flaggedrevs'; |
1216 | | - $fields[] = 'fr_quality'; |
| 1216 | + $fields[] = 'MAX(fr_quality) AS fr_quality'; |
| 1217 | + # Avoid duplicate rows due to multiple revs with the same sha-1 key |
| 1218 | + $opts['GROUP BY'] = 'oi_name,oi_timestamp'; |
1217 | 1219 | $join_conds['flaggedrevs'] = array( 'LEFT JOIN', 'oi_sha1 = fr_img_sha1 AND oi_timestamp = fr_img_timestamp' ); |
1218 | 1220 | } |
1219 | 1221 | return true; |