r88917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88916‎ | r88917 | r88918 >
Date:19:20, 26 May 2011
Author:reedy
Status:ok
Tags:
Comment:
Remove unused variables/globals

Swap while to foreach
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Metadata.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/revisiondelete/RevisionDelete.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -870,7 +870,6 @@
871871 # @todo FIXME: This is expensive; cache this info somewhere.
872872
873873 $dbr = wfGetDB( DB_SLAVE );
874 - $userTable = $dbr->tableName( 'user' );
875874
876875 if ( $dbr->implicitGroupby() ) {
877876 $realNameField = 'user_real_name';
Index: trunk/phase3/includes/parser/Parser.php
@@ -950,7 +950,6 @@
951951 * @private
952952 */
953953 function getCellAttr ( $cell, $tagName ) {
954 - $content = null;
955954 $attributes = null;
956955
957956 $cell = trim ( $cell );
@@ -965,8 +964,7 @@
966965 }
967966 else if ( count ( $cellData ) == 1 ) {
968967 $content = trim ( $cellData[0] );
969 - }
970 - else {
 968+ } else {
971969 $attributes = $this->mStripState->unstripBoth( $cellData[0] );
972970 $attributes = Sanitizer::fixTagAttributes( $attributes , $tagName );
973971
Index: trunk/phase3/includes/revisiondelete/RevisionDelete.php
@@ -53,10 +53,10 @@
5454 } else {
5555 // Combine the two! Whee
5656 $rows = array();
57 - while ( $row = $live->fetchObject() ) {
 57+ foreach ( $live as $row ) {
5858 $rows[$row->rev_id] = $row;
5959 }
60 - while ( $row = $archived->fetchObject() ) {
 60+ foreach ( $archived as $row ) {
6161 $rows[$row->ar_rev_id] = $row;
6262 }
6363 krsort( $rows );
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -731,7 +731,6 @@
732732
733733 // Validate password
734734 $msg = false;
735 - $valid = false;
736735 $pwd = $this->getVar( '_AdminPassword' );
737736 $user = User::newFromName( $cname );
738737 $valid = $user && $user->getPasswordValidity( $pwd );
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -319,7 +319,7 @@
320320 * @return String: HTML fragment
321321 */
322322 protected function getForm() {
323 - global $wgScript, $wgMiserMode, $wgRCMaxAge, $wgContLang;
 323+ global $wgScript, $wgMiserMode;
324324
325325 $this->opts['title'] = $this->getTitle()->getPrefixedText();
326326 if( !isset( $this->opts['target'] ) ) {
Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -689,12 +689,14 @@
690690 $rp .= "+(\\$i)";
691691 }
692692
693 - $rx = "/$rx/Sei"; $O = substr("$alpha')", 1);
 693+ $rx = "/$rx/Sei";
 694+ $O = substr("$alpha')", 1);
694695 for ( $i = 1; $i <= strlen( $rx ) / 3; $i++ ) {
695696 $rx[$i-1] = strtolower( $rx[$i-1] );
696697 }
697698 $ry = ".*?(.((.)(.))).{1,3}(.)(.{1,$i})(\\4.\\3)(.).*";
698 - $ry = "/$ry/Sei"; $O = substr("$beta')", 1);
 699+ $ry = "/$ry/Sei";
 700+ $O = substr("$beta')", 1);
699701 preg_match_all('/(?<=\$)[[:alnum:]]*/',substr($juliet, 0, $i<<1), $charlie);
700702 foreach( $charlie[0] as $bravo ) {
701703 $$bravo =& $xe;
Index: trunk/phase3/includes/Metadata.php
@@ -88,10 +88,11 @@
8989 }
9090
9191 protected function pageOrString( $name, $page, $str ) {
92 - if( $page instanceof Title )
 92+ if( $page instanceof Title ) {
9393 $nt = $page;
94 - else
 94+ } else {
9595 $nt = Title::newFromText( $page );
 96+ }
9697
9798 if( !$nt || $nt->getArticleID() == 0 ){
9899 $this->element( $name, $str );

Status & tagging log