Remove unused variables/globals
authorSam Reed <reedy@users.mediawiki.org>
Thu, 26 May 2011 19:20:35 +0000 (19:20 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 26 May 2011 19:20:35 +0000 (19:20 +0000)
Swap while to foreach

includes/Article.php
includes/Metadata.php
includes/installer/WebInstallerPage.php
includes/parser/Parser.php
includes/revisiondelete/RevisionDelete.php
includes/specials/SpecialContributions.php
includes/specials/SpecialVersion.php

index 807a029..915ee7a 100644 (file)
@@ -870,7 +870,6 @@ class Article {
                # @todo FIXME: This is expensive; cache this info somewhere.
 
                $dbr = wfGetDB( DB_SLAVE );
-               $userTable = $dbr->tableName( 'user' );
 
                if ( $dbr->implicitGroupby() ) {
                        $realNameField = 'user_real_name';
index 6439ef3..463b497 100644 (file)
@@ -88,10 +88,11 @@ abstract class RdfMetaData {
        }
 
        protected function pageOrString( $name, $page, $str ) {
-               if( $page instanceof Title )
+               if( $page instanceof Title ) {
                        $nt = $page;
-               else
+               } else {
                        $nt = Title::newFromText( $page );
+               }
 
                if( !$nt || $nt->getArticleID() == 0 ){
                        $this->element( $name, $str );
index 5cec53f..d450d92 100644 (file)
@@ -731,7 +731,6 @@ class WebInstaller_Name extends WebInstallerPage {
 
                // Validate password
                $msg = false;
-               $valid = false;
                $pwd = $this->getVar( '_AdminPassword' );
                $user = User::newFromName( $cname );
                $valid = $user && $user->getPasswordValidity( $pwd );
index d0f97e6..bdb47b1 100644 (file)
@@ -950,7 +950,6 @@ class Parser {
         * @private
         */
        function getCellAttr ( $cell, $tagName ) {
-               $content = null;
                $attributes = null;
 
                $cell = trim ( $cell );
@@ -965,8 +964,7 @@ class Parser {
                }
                else if ( count ( $cellData ) == 1 ) {
                        $content = trim ( $cellData[0] );
-               }
-               else {
+               } else {
                        $attributes = $this->mStripState->unstripBoth( $cellData[0] );
                        $attributes = Sanitizer::fixTagAttributes( $attributes , $tagName );
 
index 5b6e63e..9f79837 100644 (file)
@@ -53,10 +53,10 @@ class RevDel_RevisionList extends RevDel_List {
                } else {
                        // Combine the two! Whee
                        $rows = array();
-                       while ( $row = $live->fetchObject() ) {
+                       foreach ( $live as $row ) {
                                $rows[$row->rev_id] = $row;
                        }
-                       while ( $row = $archived->fetchObject() ) {
+                       foreach ( $archived as $row ) {
                                $rows[$row->ar_rev_id] = $row;
                        }
                        krsort( $rows );
index 6da6f87..f4c3905 100644 (file)
@@ -319,7 +319,7 @@ class SpecialContributions extends SpecialPage {
         * @return String: HTML fragment
         */
        protected function getForm() {
-               global $wgScript, $wgMiserMode, $wgRCMaxAge, $wgContLang;
+               global $wgScript, $wgMiserMode;
 
                $this->opts['title'] = $this->getTitle()->getPrefixedText();
                if( !isset( $this->opts['target'] ) ) {
index 53c5e87..f58d366 100644 (file)
@@ -689,12 +689,14 @@ class SpecialVersion extends SpecialPage {
                        $rp .= "+(\\$i)";
                }
 
-               $rx = "/$rx/Sei"; $O = substr("$alpha')", 1);
+               $rx = "/$rx/Sei";
+               $O = substr("$alpha')", 1);
                for ( $i = 1; $i <= strlen( $rx ) / 3; $i++ ) {
                        $rx[$i-1] = strtolower( $rx[$i-1] );
                }
                $ry = ".*?(.((.)(.))).{1,3}(.)(.{1,$i})(\\4.\\3)(.).*";
-               $ry = "/$ry/Sei"; $O = substr("$beta')", 1);
+               $ry = "/$ry/Sei";
+               $O = substr("$beta')", 1);
                preg_match_all('/(?<=\$)[[:alnum:]]*/',substr($juliet, 0, $i<<1), $charlie);
                foreach( $charlie[0] as $bravo ) {
                        $$bravo =& $xe;