Index: trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | foreach ( $res as $row ) { |
38 | 38 | $tags = FlaggedRevision::expandRevisionTags( $row->fr_tags ); |
39 | 39 | # Quality rating levels may have changed due to config tweaks... |
40 | | - $quality = max( 0, FlaggedRevs::getLevelTier( $tags ) ); |
| 40 | + $quality = FlaggedRevs::getQualityTier( $tags, 0 /* sanity */ ); |
41 | 41 | |
42 | 42 | $file = $row->fr_img_name; |
43 | 43 | $fileTime = $row->fr_img_timestamp; |
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php |
— | — | @@ -328,7 +328,7 @@ |
329 | 329 | } |
330 | 330 | |
331 | 331 | /* |
332 | | - * Remove a FlaggedRevision object into the database |
| 332 | + * Remove a FlaggedRevision object from the database |
333 | 333 | * |
334 | 334 | * @return bool success |
335 | 335 | */ |
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php |
— | — | @@ -782,9 +782,10 @@ |
783 | 783 | /** |
784 | 784 | * Get the quality tier of review flags |
785 | 785 | * @param array $flags |
| 786 | + * @param int $default Return value if one of the tags has value < 0 |
786 | 787 | * @return int flagging tier (FR_PRISTINE,FR_QUALITY,FR_CHECKED,-1) |
787 | 788 | */ |
788 | | - public static function getLevelTier( array $flags ) { |
| 789 | + public static function getQualityTier( array $flags, $default = -1 ) { |
789 | 790 | if ( self::isPristine( $flags ) ) { |
790 | 791 | return FR_PRISTINE; // 2 |
791 | 792 | } elseif ( self::isQuality( $flags ) ) { |
— | — | @@ -792,7 +793,7 @@ |
793 | 794 | } elseif ( self::isChecked( $flags ) ) { |
794 | 795 | return FR_CHECKED; // 0 |
795 | 796 | } |
796 | | - return -1; |
| 797 | + return (int)$default; |
797 | 798 | } |
798 | 799 | |
799 | 800 | /** |
— | — | @@ -930,11 +931,6 @@ |
931 | 932 | return false; // can't auto-review this revision |
932 | 933 | } |
933 | 934 | } |
934 | | - # Get quality tier from flags |
935 | | - $quality = 0; |
936 | | - if ( self::isQuality( $flags ) ) { |
937 | | - $quality = self::isPristine( $flags ) ? 2 : 1; |
938 | | - } |
939 | 935 | # Get review property flags |
940 | 936 | $propFlags = $auto ? array( 'auto' ) : array(); |
941 | 937 | |
— | — | @@ -960,7 +956,7 @@ |
961 | 957 | 'rev' => $rev, |
962 | 958 | 'user_id' => $user->getId(), |
963 | 959 | 'timestamp' => $rev->getTimestamp(), // same as edit time |
964 | | - 'quality' => $quality, |
| 960 | + 'quality' => FlaggedRevs::getQualityTier( $flags, 0 /* sanity */ ), |
965 | 961 | 'tags' => FlaggedRevision::flattenRevisionTags( $flags ), |
966 | 962 | 'img_name' => $fileData['name'], |
967 | 963 | 'img_timestamp' => $fileData['timestamp'], |