r76492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76491‎ | r76492 | r76493 >
Date:02:59, 11 November 2010
Author:aaron
Status:deferred
Tags:
Comment:
* Simplified quickTags() function
* getMinQL()/getMinPL() unused
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -244,7 +244,7 @@
245245 global $wgFlaggedRevsComments;
246246 return $wgFlaggedRevsComments;
247247 }
248 -
 248+
249249 /**
250250 * Get the array of tag dimensions and level messages
251251 * @returns array
@@ -253,26 +253,8 @@
254254 self::load();
255255 return self::$dimensions;
256256 }
257 -
 257+
258258 /**
259 - * Get min level this tag needs to be for a rev to be "quality"
260 - * @returns int
261 - */
262 - public static function getMinQL( $tag ) {
263 - self::load();
264 - return self::$minQL[$tag];
265 - }
266 -
267 - /**
268 - * Get min level this tag needs to be for a rev to be "pristine"
269 - * @returns int
270 - */
271 - public static function getMinPL( $tag ) {
272 - self::load();
273 - return self::$minPL[$tag];
274 - }
275 -
276 - /**
277259 * Get the associative array of tag dimensions
278260 * (tags => array(levels => msgkey))
279261 * @returns array
@@ -867,11 +849,12 @@
868850 */
869851 public static function getRevisionTags( Title $title, $rev_id ) {
870852 $dbr = wfGetDB( DB_SLAVE );
871 - $tags = $dbr->selectField( 'flaggedrevs', 'fr_tags',
 853+ $tags = (string)$dbr->selectField( 'flaggedrevs',
 854+ 'fr_tags',
872855 array( 'fr_rev_id' => $rev_id,
873856 'fr_page_id' => $title->getArticleId() ),
874 - __METHOD__ );
875 - $tags = $tags ? $tags : "";
 857+ __METHOD__
 858+ );
876859 return FlaggedRevision::expandRevisionTags( strval( $tags ) );
877860 }
878861
@@ -1161,7 +1144,7 @@
11621145 /**
11631146 * Get the quality tier of review flags
11641147 * @param array $flags
1165 - * @return int, flagging tier (-1 for non-checked)
 1148+ * @return int flagging tier (FR_PRISTINE,FR_QUALITY,FR_CHECKED,-1)
11661149 */
11671150 public static function getLevelTier( array $flags ) {
11681151 if ( self::isPristine( $flags ) ) {
@@ -1176,26 +1159,17 @@
11771160
11781161 /**
11791162 * Get minimum level tags for a tier
 1163+ * @param int $tier FR_PRISTINE/FR_QUALITY/FR_CHECKED
11801164 * @return array
11811165 */
11821166 public static function quickTags( $tier ) {
11831167 self::load();
1184 - switch( $tier ) // select reference levels
1185 - {
1186 - case FR_PRISTINE:
1187 - $minLevels = self::$minPL;
1188 - break;
1189 - case FR_QUALITY:
1190 - $minLevels = self::$minQL;
1191 - break;
1192 - default:
1193 - $minLevels = self::$minSL;
 1168+ if ( $tier == FR_PRISTINE ) {
 1169+ return self::$minPL;
 1170+ } elseif ( $tier == FR_QUALITY ) {
 1171+ return self::$minQL;
11941172 }
1195 - $flags = array();
1196 - foreach ( self::getTags() as $tag ) {
1197 - $flags[$tag] = $minLevels[$tag];
1198 - }
1199 - return $flags;
 1173+ return self::$minSL;
12001174 }
12011175
12021176 /**

Status & tagging log