r21679 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21678‎ | r21679 | r21680 >
Date:01:15, 28 April 2007
Author:aaron
Status:old
Tags:
Comment:
Add getLCQuality()
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -311,10 +311,10 @@
312312 // of key flags that were fulfilled
313313 $result = $db->select(
314314 array('flaggedrevtags','flaggedrevs','revision'),
315 - array('fr_rev_id', 'fr_user', 'fr_timestamp', 'fr_comment', 'rev_timestamp'),
 315+ array('fr_rev_id', 'fr_user', 'fr_timestamp', 'fr_comment', 'rev_timestamp', 'COUNT(*)'),
316316 array('frt_page_id' => $page_id, $tagwhere, $maxrevid, 'frt_rev_id=fr_rev_id', 'fr_rev_id=rev_id', 'rev_deleted=0'),
317317 __METHOD__,
318 - array('GROUP BY' => 'frt_rev_id', 'HAVING' => 'COUNT(*)=='.$wgFlaggedRevTags, 'ORDER BY' => 'frt_rev_id DESC', 'LIMIT' => $limit) );
 318+ array('GROUP BY' => 'frt_rev_id', 'HAVING' => 'COUNT(*)='.$wgFlaggedRevTags, 'ORDER BY' => 'frt_rev_id DESC', 'LIMIT' => $limit) );
319319 // Iterate through each flagged revision row
320320 $out = array();
321321 while ( $row = $db->fetchObject($result) ) {
@@ -574,6 +574,20 @@
575575 }
576576 return true;
577577 }
 578+
 579+ /**
 580+ * @param Array $flags
 581+ * @output integer, lowest rating level
 582+ */
 583+ public static function getLCQuality( $flags ) {
 584+ global $wgFlaggedRevValues;
 585+
 586+ $min = false;
 587+ foreach ( $flags as $f => $v ) {
 588+ if ( $min==false || $v < $min ) $min = $v;
 589+ }
 590+ return $min;
 591+ }
578592
579593 }
580594