r86357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86356‎ | r86357 | r86358 >
Date:22:42, 18 April 2011
Author:aaron
Status:ok
Tags:
Comment:
* Improved getLevelTier() and added another use
* Fixed doc typo
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc
@@ -36,7 +36,7 @@
3737 foreach ( $res as $row ) {
3838 $tags = FlaggedRevision::expandRevisionTags( $row->fr_tags );
3939 # Quality rating levels may have changed due to config tweaks...
40 - $quality = max( 0, FlaggedRevs::getLevelTier( $tags ) );
 40+ $quality = FlaggedRevs::getQualityTier( $tags, 0 /* sanity */ );
4141
4242 $file = $row->fr_img_name;
4343 $fileTime = $row->fr_img_timestamp;
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php
@@ -328,7 +328,7 @@
329329 }
330330
331331 /*
332 - * Remove a FlaggedRevision object into the database
 332+ * Remove a FlaggedRevision object from the database
333333 *
334334 * @return bool success
335335 */
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.class.php
@@ -782,9 +782,10 @@
783783 /**
784784 * Get the quality tier of review flags
785785 * @param array $flags
 786+ * @param int $default Return value if one of the tags has value < 0
786787 * @return int flagging tier (FR_PRISTINE,FR_QUALITY,FR_CHECKED,-1)
787788 */
788 - public static function getLevelTier( array $flags ) {
 789+ public static function getQualityTier( array $flags, $default = -1 ) {
789790 if ( self::isPristine( $flags ) ) {
790791 return FR_PRISTINE; // 2
791792 } elseif ( self::isQuality( $flags ) ) {
@@ -792,7 +793,7 @@
793794 } elseif ( self::isChecked( $flags ) ) {
794795 return FR_CHECKED; // 0
795796 }
796 - return -1;
 797+ return (int)$default;
797798 }
798799
799800 /**
@@ -930,11 +931,6 @@
931932 return false; // can't auto-review this revision
932933 }
933934 }
934 - # Get quality tier from flags
935 - $quality = 0;
936 - if ( self::isQuality( $flags ) ) {
937 - $quality = self::isPristine( $flags ) ? 2 : 1;
938 - }
939935 # Get review property flags
940936 $propFlags = $auto ? array( 'auto' ) : array();
941937
@@ -960,7 +956,7 @@
961957 'rev' => $rev,
962958 'user_id' => $user->getId(),
963959 'timestamp' => $rev->getTimestamp(), // same as edit time
964 - 'quality' => $quality,
 960+ 'quality' => FlaggedRevs::getQualityTier( $flags, 0 /* sanity */ ),
965961 'tags' => FlaggedRevision::flattenRevisionTags( $flags ),
966962 'img_name' => $fileData['name'],
967963 'img_timestamp' => $fileData['timestamp'],

Status & tagging log