r76606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76605‎ | r76606 | r76607 >
Date:00:19, 13 November 2010
Author:reedy
Status:ok
Tags:
Comment:
Revert the rest of my daft parts of r75973
Modified paths:
  • /trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php (modified) (history)
  • /trunk/extensions/FixedImage/FixedImage.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/ReaderFeedback.class.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/ReaderFeedback.hooks.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/ReaderFeedbackXML.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/specialpages/ReaderFeedback_body.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/main/Context.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/talliers/HistogramRangeTallier.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/talliers/PluralityTallier.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/talliers/SchulzeTallier.php (modified) (history)
  • /trunk/extensions/SiteMatrix/SiteMatrix_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExtensionDistributor/ExtensionDistributor_body.php
@@ -69,7 +69,7 @@
7070
7171 $this->extensionList = array();
7272
73 - foreach ( $wgExtDistBranches as $branchPath ) {
 73+ foreach ( $wgExtDistBranches as $branchPath => $branch ) {
7474 $wc = "$wgExtDistWorkingCopy/$branchPath/extensions";
7575 $dir = opendir( $wc );
7676
Index: trunk/extensions/FixedImage/FixedImage.php
@@ -47,7 +47,7 @@
4848
4949 function fixedImageSetup( &$parser ) {
5050 global $wgFixedImageHooks;
51 - foreach( $wgFixedImageHooks as $key ) {
 51+ foreach( $wgFixedImageHooks as $key => $data ) {
5252 $wrapper = create_function( '$text, $params=null',
5353 "return fixedImageHandler('$key', \$text, \$params);" );
5454 $parser->setHook( $key, $wrapper );
Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php
@@ -78,7 +78,7 @@
7979 uasort( $this->specials, array( __CLASS__, 'sortSpecial' ) );
8080
8181 if( $hideEmpty ){
82 - foreach( $xLanglist as $lang ){
 82+ foreach( $xLanglist as $lang => $unused ){
8383 $empty = true;
8484 foreach ( $this->sites as $site ) {
8585 if( !empty( $this->matrix[$site][$lang] ) ){
Index: trunk/extensions/ReaderFeedback/ReaderFeedback.hooks.php
@@ -133,7 +133,7 @@
134134 'onchange' => "updateFeedbackForm()" );
135135 $form .= ' ' . Xml::openElement( 'select', $attribs );
136136 $levels = array_reverse($levels,true);
137 - foreach( $levels as $i ) {
 137+ foreach( $levels as $i => $name ) {
138138 $optionClass = array( 'class' => "rfb-rating-option-$i" );
139139 $form .= Xml::option( wfMsg("readerfeedback-level-$i"), $i, ($i == $selected), $optionClass ) ."\n";
140140 }
Index: trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php
@@ -117,7 +117,7 @@
118118 $data = false;
119119 $html = '';
120120 // Do each graphs for said time period
121 - foreach( ReaderFeedback::getFeedbackTags() as $tag ) {
 121+ foreach( ReaderFeedback::getFeedbackTags() as $tag => $weight ) {
122122 // Check if cached version is available.
123123 // If not, then generate a new one.
124124 $filePath = $this->getFilePath( $tag );
Index: trunk/extensions/ReaderFeedback/specialpages/ReaderFeedback_body.php
@@ -54,7 +54,7 @@
5555 # Get our rating dimensions
5656 $this->dims = array();
5757 $unsureCount = 0;
58 - foreach( ReaderFeedback::getFeedbackTags() as $tag ) {
 58+ foreach( ReaderFeedback::getFeedbackTags() as $tag => $weight ) {
5959 $this->dims[$tag] = $wgRequest->getIntOrNull( "wp$tag" );
6060 if( $this->dims[$tag] === null ) { // nothing sent at all :(
6161 $wgOut->redirect( $this->page->getLocalUrl() );
Index: trunk/extensions/ReaderFeedback/ReaderFeedback.class.php
@@ -204,7 +204,7 @@
205205 array( 'USE INDEX' => array('revision' => 'page_timestamp') )
206206 );
207207 $votes = array();
208 - foreach( ReaderFeedback::getFeedbackTags() as $tag ) {
 208+ foreach( ReaderFeedback::getFeedbackTags() as $tag => $w ) {
209209 $votes[$tag] = array( 0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0 );
210210 }
211211 // Read votes and tally the numbers
@@ -226,7 +226,7 @@
227227 }
228228 // Output multi-column list
229229 $html = "<table class='rfb-reader_feedback_table' cellspacing='0'><tr>";
230 - foreach( ReaderFeedback::getFeedbackTags() as $tag ) {
 230+ foreach( ReaderFeedback::getFeedbackTags() as $tag => $w ) {
231231 // Get tag average...
232232 $dist = isset($votes[$tag]) ? $votes[$tag] : array();
233233 $count = array_sum($dist);
Index: trunk/extensions/ReaderFeedback/ReaderFeedbackXML.php
@@ -47,7 +47,7 @@
4848 public static function getTagMenu( $selected = '' ) {
4949 $s = "<label for='wpRatingTag'>" . wfMsgHtml('readerfeedback-tagfilter') . "</label>&#160;";
5050 $s .= Xml::openElement( 'select', array('name' => 'ratingtag', 'id' => 'wpRatingTag') );
51 - foreach( ReaderFeedback::getFeedbackTags() as $tag ) {
 51+ foreach( ReaderFeedback::getFeedbackTags() as $tag => $weight ) {
5252 $s .= Xml::option( wfMsg( "readerfeedback-$tag" ), $tag, $selected===$tag );
5353 }
5454 $s .= Xml::closeElement('select')."\n";
Index: trunk/extensions/SecurePoll/includes/talliers/SchulzeTallier.php
@@ -93,7 +93,7 @@
9494 }
9595
9696 # Now $winners is the list of candidates that tie for this position
97 - foreach ( $winners as $oid ) {
 97+ foreach ( $winners as $oid => $unused ) {
9898 $ranks[$oid] = $currentRank;
9999 }
100100 $currentRank += count( $winners );
Index: trunk/extensions/SecurePoll/includes/talliers/PluralityTallier.php
@@ -33,7 +33,7 @@
3434 // Show the results
3535 $s = "<table class=\"securepoll-results\">\n";
3636
37 - foreach ( $this->tally as $oid ) {
 37+ foreach ( $this->tally as $oid => $rank ) {
3838 $option = $this->optionsById[$oid];
3939 $s .= '<tr><td>' . $option->parseMessageInline( 'text' ) . "</td>\n" .
4040 '<td>' . $this->tally[$oid] . "</td>\n" .
@@ -46,7 +46,7 @@
4747 function getTextResult() {
4848 // Calculate column width
4949 $width = 10;
50 - foreach ( $this->tally as $oid ) {
 50+ foreach ( $this->tally as $oid => $rank ) {
5151 $option = $this->optionsById[$oid];
5252 $width = max( $width, strlen( $option->getMessage( 'text' ) ) );
5353 }
@@ -60,7 +60,7 @@
6161 if ( $qtext !== '' ) {
6262 $s .= wordwrap( $qtext ) . "\n";
6363 }
64 - foreach ( $this->tally as $oid ) {
 64+ foreach ( $this->tally as $oid => $rank ) {
6565 $option = $this->optionsById[$oid];
6666 $otext = $option->getMessage( 'text' );
6767 if ( strlen( $otext ) > $width ) {
Index: trunk/extensions/SecurePoll/includes/talliers/HistogramRangeTallier.php
@@ -69,7 +69,7 @@
7070 Xml::tags( 'td', array( 'class' => 'securepoll-results-row-heading' ),
7171 $optionLabels[$oid] ) .
7272 "\n";
73 - foreach ( $labels as $score ) {
 73+ foreach ( $labels as $score => $label ) {
7474 $s .= Xml::element( 'td', array(), $this->histogram[$oid][$score] ) . "\n";
7575 }
7676 $s .= Xml::element( 'td', array(), $average ) . "\n";
Index: trunk/extensions/SecurePoll/includes/main/Context.php
@@ -197,7 +197,7 @@
198198 if ( isset( $this->messagesLoaded[$lang] ) ) {
199199 $cacheRow = $this->messagesLoaded[$lang];
200200 $uncachedIds = array_flip( $ids );
201 - foreach ( $uncachedIds as $id ) {
 201+ foreach ( $uncachedIds as $id => $unused ) {
202202 if ( isset( $cacheRow[$id] ) ) {
203203 unset( $uncachedIds[$id] );
204204 }

Past revisions this follows-up on

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

Status & tagging log