r76229 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76228‎ | r76229 | r76230 >
Date:02:58, 7 November 2010
Author:aaron
Status:resolved
Tags:
Comment:
* Fix fatals from r75973 (in for loops)
* Used simpler getTags() instead of getDimensions() in other places too
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiReview.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1187,7 +1187,7 @@
11881188 $minLevels = self::$minSL;
11891189 }
11901190 $flags = array();
1191 - foreach ( self::getDimensions() as $tag => $x ) {
 1191+ foreach ( self::getTags() as $tag ) {
11921192 $flags[$tag] = $minLevels[$tag];
11931193 }
11941194 return $flags;
@@ -1205,7 +1205,7 @@
12061206 return null; // shouldn't happen
12071207 }
12081208 $flags = array();
1209 - foreach ( self::getDimensions() as $tag => $levels ) {
 1209+ foreach ( self::getTags() as $tag ) {
12101210 # Try to keep this tag val the same as the stable rev's
12111211 $val = isset( $oldFlags[$tag] ) ? $oldFlags[$tag] : 1;
12121212 $val = min( $val, self::maxAutoReviewLevel( $tag ) );
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -217,7 +217,7 @@
218218 if ( $iDims ) {
219219 $this->dims = $iDims;
220220 } else {
221 - foreach ( FlaggedRevs::getDimensions() as $tag ) {
 221+ foreach ( FlaggedRevs::getTags() as $tag ) {
222222 if ( $this->dims[$tag] === 0 ) {
223223 $this->unapprovedTags++;
224224 }
@@ -226,7 +226,7 @@
227227 # We must at least rate each category as 1, the minimum
228228 # Exception: we can rate ALL as unapproved to depreciate a revision
229229 if ( $this->unapprovedTags
230 - && $this->unapprovedTags < count( FlaggedRevs::getDimensions() ) )
 230+ && $this->unapprovedTags < count( FlaggedRevs::getTags() ) )
231231 {
232232 return 'review_too_low';
233233 }
@@ -748,7 +748,7 @@
749749 $form .= Xml::openElement( 'span', array( 'style' => 'white-space: nowrap;' ) );
750750 # Hide comment input if needed
751751 if ( !$disabled ) {
752 - if ( count( FlaggedRevs::getDimensions() ) > 1 ) {
 752+ if ( count( FlaggedRevs::getTags() ) > 1 ) {
753753 $form .= "<br />"; // Don't put too much on one line
754754 }
755755 $form .= "<span id='mw-fr-commentbox' style='clear:both'>" .
@@ -809,7 +809,6 @@
810810 if ( $labels === false ) {
811811 $disabled = true; // a tag is unsettable
812812 }
813 - $dimensions = FlaggedRevs::getDimensions();
814813 # If there are no tags, make one checkbox to approve/unapprove
815814 if ( FlaggedRevs::binaryFlagging() ) {
816815 return '';
@@ -818,7 +817,7 @@
819818 # Build rating form...
820819 if ( $disabled ) {
821820 // Display the value for each tag as text
822 - foreach ( $dimensions as $quality => $levels ) {
 821+ foreach ( FlaggedRevs::getTags() as $quality ) {
823822 $selected = isset( $flags[$quality] ) ? $flags[$quality] : 0;
824823 $items[] = FlaggedRevs::getTagMsg( $quality ) . ": " .
825824 FlaggedRevs::getTagValueMsg( $quality, $selected );
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -741,7 +741,7 @@
742742 public static function expandRevisionTags( $tags ) {
743743 # Set all flags to zero
744744 $flags = array();
745 - foreach ( FlaggedRevs::getDimensions() as $tag => $levels ) {
 745+ foreach ( FlaggedRevs::getTags() as $tag ) {
746746 $flags[$tag] = 0;
747747 }
748748 $tags = str_replace( '\n', "\n", $tags ); // B/C, old broken rows
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php
@@ -57,7 +57,7 @@
5858 # Special token to discourage fiddling...
5959 $form->setValidatedParams( $wgRequest->getVal( 'validatedParams' ) );
6060 # Tag values
61 - foreach ( FlaggedRevs::getDimensions() as $tag ) {
 61+ foreach ( FlaggedRevs::getTags() as $tag ) {
6262 # This can be NULL if we uncheck a checkbox
6363 $val = $wgRequest->getInt( "wp$tag" );
6464 $form->setDim( $tag, $val );
@@ -136,7 +136,7 @@
137137 if ( wfReadOnly() ) {
138138 return '<err#>' . wfMsgExt( 'revreview-failed', 'parseinline' );
139139 }
140 - $tags = FlaggedRevs::getDimensions();
 140+ $tags = FlaggedRevs::getTags();
141141 // Make review interface object
142142 $form = new RevisionReviewForm( $wgUser );
143143 $title = null; // target page
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -182,7 +182,7 @@
183183 if ( $prettyBox ) {
184184 $tag .= "<table id='mw-fr-revisionratings-box' align='center' class='$css' cellpadding='0'>";
185185 }
186 - foreach ( FlaggedRevs::getDimensions() as $quality ) {
 186+ foreach ( FlaggedRevs::getTags() as $quality ) {
187187 $level = isset( $flags[$quality] ) ? $flags[$quality] : 0;
188188 $encValueText = wfMsgHtml( "revreview-$quality-$level" );
189189 $level = $flags[$quality];
Index: trunk/extensions/FlaggedRevs/api/ApiReview.php
@@ -62,7 +62,7 @@
6363 $form->setNotes( $params['notes'] );
6464 // The flagging parameters have the form 'flag_$name'.
6565 // Extract them and put the values into $form->dims
66 - foreach ( FlaggedRevs::getDimensions() as $tag ) {
 66+ foreach ( FlaggedRevs::getTags() as $tag ) {
6767 $form->setDim( $tag, intval( $params['flag_' . $tag] ) );
6868 }
6969 if ( $form->isApproval() ) {
@@ -174,7 +174,7 @@
175175 if ( FlaggedRevs::dimensionsEmpty() ) {
176176 $desc['unapprove'] = "If set, revision will be unapproved rather than approved.";
177177 } else {
178 - foreach ( FlaggedRevs::getDimensions() as $flagname ) {
 178+ foreach ( FlaggedRevs::getTags() as $flagname ) {
179179 $desc['flag_' . $flagname] = "Set the flag ''{$flagname}'' to the specified value";
180180 }
181181 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r76494(bug 25849) Fixed error from r76229 that made AJAX review think all tags had ...aaron03:27, 11 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75973Code cleanup, mainly unused variablesreedy01:29, 4 November 2010

Status & tagging log