From 696100b6a9787307ae4aff0c46e7921adb108777 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 26 May 2011 19:20:35 +0000 Subject: [PATCH] Remove unused variables/globals Swap while to foreach --- includes/Article.php | 1 - includes/Metadata.php | 5 +++-- includes/installer/WebInstallerPage.php | 1 - includes/parser/Parser.php | 4 +--- includes/revisiondelete/RevisionDelete.php | 4 ++-- includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialVersion.php | 6 ++++-- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 807a029366..915ee7a415 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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'; diff --git a/includes/Metadata.php b/includes/Metadata.php index 6439ef318f..463b497c2f 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -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 ); diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 5cec53f248..d450d92d55 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -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 ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index d0f97e6412..bdb47b1229 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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 ); diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php index 5b6e63e9ab..9f79837ec6 100644 --- a/includes/revisiondelete/RevisionDelete.php +++ b/includes/revisiondelete/RevisionDelete.php @@ -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 ); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 6da6f87404..f4c3905168 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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'] ) ) { diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 53c5e876e4..f58d366d8d 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -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; -- 2.20.1