Big attack on unused variables...
authorSam Reed <reedy@users.mediawiki.org>
Thu, 14 Oct 2010 20:53:04 +0000 (20:53 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 14 Oct 2010 20:53:04 +0000 (20:53 +0000)
64 files changed:
config/Installer.php
includes/BagOStuff.php
includes/ConfEditor.php
includes/DistributionRepository.php
includes/EditPage.php
includes/HTMLFileCache.php
includes/HTMLForm.php
includes/ImagePage.php
includes/ImportXMLReader.php
includes/Interwiki.php
includes/LogEventsList.php
includes/MessageCache.php
includes/MimeMagic.php
includes/PoolCounter.php
includes/Preferences.php
includes/ResourceLoaderModule.php
includes/Revision.php
includes/RevisionDelete.php
includes/Skin.php
includes/Title.php
includes/User.php
includes/Wiki.php
includes/Xml.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php
includes/db/LoadBalancer.php
includes/filerepo/ForeignAPIRepo.php
includes/filerepo/RepoGroup.php
includes/installer/CoreInstaller.php
includes/job/JobQueue.php
includes/parser/Parser.php
includes/parser/Parser_DiffTest.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/specials/SpecialBooksources.php
includes/specials/SpecialContributions.php
includes/specials/SpecialIpblocklist.php
includes/specials/SpecialListfiles.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialProtectedtitles.php
includes/specials/SpecialRevisionMove.php
includes/specials/SpecialSearch.php
includes/specials/SpecialUpload.php
languages/Language.php
languages/LanguageConverter.php
languages/classes/LanguageKk.php
languages/classes/LanguageKk_cyrl.php
maintenance/dumpInterwiki.php
maintenance/gearman/gearman.inc
maintenance/lag.php
maintenance/language/checkLanguage.inc
maintenance/language/countMessages.php
maintenance/nextJobDB.php
maintenance/populateSha1.php
maintenance/renameDbPrefix.php
maintenance/tests/parser/parserTest.inc
maintenance/tests/phpunit/includes/search/SearchEngineTest.php
maintenance/userDupes.inc
profileinfo.php
skins/MonoBook.php
skins/Vector.php

index 56323fc..e2d0134 100644 (file)
@@ -2106,8 +2106,9 @@ function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick =
        $id = $field;
        $nolabel = ($type == "radio") || ($type == "hidden");
 
-       if ($type == 'radio')
+       if ($type == 'radio') {
                $id .= $radioCount++;
+       }
 
        if( !$nolabel ) {
                echo "<label class='column' for=\"$id\">$text</label>";
index d2c95fe..04900f4 100644 (file)
@@ -137,7 +137,6 @@ abstract class BagOStuff {
 
                $value = intval( $value );
 
-               $n = false;
                if ( ( $n = $this->get( $key ) ) !== false ) {
                        $n += $value;
                        $this->set( $key, $n ); // exptime?
index a1a3431..4bd55ac 100644 (file)
@@ -336,7 +336,7 @@ class ConfEditor {
                // Split all copy operations with a source corresponding to the region
                // in question.
                $newEdits = array();
-               foreach ( $this->edits as $i => $edit ) {
+               foreach ( $this->edits as $edit ) {
                        if ( $edit[0] !== 'copy' ) {
                                $newEdits[] = $edit;
                                continue;
index f9e255f..8aabb51 100644 (file)
@@ -139,11 +139,9 @@ class DistributionRepository extends PackageRepository {
         * @since 1.17
         */             
        public function getLatestCoreVersion() {
-               global $wgRepositoryPackageStates;
-               
-               $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-               
                // TODO: use $states
+               //global $wgRepositoryPackageStates;
+               //$states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
                
                $response = Http::get(
                        "$this->location?format=json&action=mwreleases",
index d71dfce..45abdfc 100644 (file)
@@ -136,7 +136,6 @@ class EditPage {
                $undoafter = $wgRequest->getVal( 'undoafter' );
                $undo = $wgRequest->getVal( 'undo' );
 
-               $text = '';
                // For message page not locally set, use the i18n message.
                // For other non-existent articles, use preload text if any.
                if ( !$this->mTitle->exists() ) {
index 3b4a886..edae81b 100644 (file)
@@ -32,11 +32,7 @@ class HTMLFileCache {
                if( !$this->mFileCache ) {
                        global $wgCacheDirectory, $wgFileCacheDirectory;
 
-                       if ( $wgFileCacheDirectory ) {
-                               $dir = $wgFileCacheDirectory;
-                       } elseif ( $wgCacheDirectory ) {
-                               $dir = "$wgCacheDirectory/html";
-                       } else {
+                       if ( !$wgFileCacheDirectory && !$wgCacheDirectory ) {
                                throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' );
                        }
 
@@ -51,8 +47,9 @@ class HTMLFileCache {
                        $hash2 = substr( $hash, 0, 2 );
                        $this->mFileCache = "{$wgFileCacheDirectory}/{$subdir}{$hash1}/{$hash2}/{$key}.html";
 
-                       if( $this->useGzip() )
+                       if( $this->useGzip() ) {
                                $this->mFileCache .= '.gz';
+                       }
 
                        wfDebug( __METHOD__ . ": {$this->mFileCache}\n" );
                }
index 4184128..1192669 100644 (file)
@@ -921,7 +921,7 @@ abstract class HTMLFormField {
        public static function flattenOptions( $options ) {
                $flatOpts = array();
 
-               foreach ( $options as $key => $value ) {
+               foreach ( $options as $value ) {
                        if ( is_array( $value ) ) {
                                $flatOpts = array_merge( $flatOpts, self::flattenOptions( $value ) );
                        } else {
index 91fd25d..06cc5f3 100644 (file)
@@ -300,7 +300,6 @@ class ImagePage extends Article {
                $this->loadFile();
 
                $full_url  = $this->displayImg->getURL();
-               $linkAttribs = false;
                $sizeSel = intval( $wgUser->getOption( 'imagesize' ) );
                if ( !isset( $wgImageLimits[$sizeSel] ) ) {
                        $sizeSel = User::getDefaultOption( 'imagesize' );
@@ -331,7 +330,7 @@ class ImagePage extends Article {
                        $width = $width_orig;
                        $height_orig = $this->displayImg->getHeight( $page );
                        $height = $height_orig;
-                       $mime = $this->displayImg->getMimeType();
+
                        $showLink = false;
                        $linkAttribs = array( 'href' => $full_url );
                        $longDesc = $this->displayImg->getLongDesc();
index 9a9e6c4..790d1a0 100644 (file)
@@ -608,7 +608,6 @@ class WikiImporter {
        private function processTitle( $text ) {
                $workTitle = $text;
                $origTitle = Title::newFromText( $workTitle );
-               $title = null;
 
                if( !is_null( $this->mTargetNamespace ) && !is_null( $origTitle ) ) {
                        $title = Title::makeTitle( $this->mTargetNamespace,
index 865119a..5a3b655 100644 (file)
@@ -143,7 +143,7 @@ class Interwiki {
                global $wgMemc, $wgInterwikiExpiry;
                $key = wfMemcKey( 'interwiki', $prefix );
                $mc = $wgMemc->get( $key );
-               $iw = false;
+
                if( $mc && is_array( $mc ) ) { // is_array is hack for old keys
                        $iw = Interwiki::loadFromArray( $mc );
                        if( $iw ) {
index 62c3184..711dec2 100644 (file)
@@ -321,7 +321,6 @@ class LogEventsList {
        }
 
        private function logUserLinks( $row ) {
-               $userLinks = '';
                if( self::isDeleted( $row, LogPage::DELETED_USER ) ) {
                        $userLinks = '<span class="history-deleted">' .
                                wfMsgHtml( 'rev-deleted-user' ) . '</span>';
@@ -337,7 +336,6 @@ class LogEventsList {
        }
 
        private function logAction( $row, $title, $paramArray ) {
-               $action = '';
                if( self::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
                        $action = '<span class="history-deleted">' .
                                wfMsgHtml( 'rev-deleted-event' ) . '</span>';
@@ -350,7 +348,6 @@ class LogEventsList {
        
        private function logComment( $row ) {
                global $wgContLang;
-               $comment = '';
                if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
                        $comment = '<span class="history-deleted">' .
                                wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
@@ -582,7 +579,7 @@ class LogEventsList {
        public static function userCanBitfield( $bitfield, $field ) {
                if( $bitfield & $field ) {
                        global $wgUser;
-                       $permission = '';
+
                        if ( $bitfield & LogPage::DELETED_RESTRICTED ) {
                                $permission = 'suppressrevision';
                        } else {
index 33b7e42..0afb2df 100644 (file)
@@ -868,7 +868,7 @@ class MessageCache {
 
                $list = array();
 
-               foreach( $data as $date => $messages ) {
+               foreach( $data as $messages ) {
                        foreach( $messages as $message => $count ) {
                                $key = $message;
                                if ( !isset( $list[$key] ) ) $list[$key] = 0;
index cde30bc..d86012c 100644 (file)
@@ -898,7 +898,6 @@ class MimeMagic {
                }
 
                # Check for entry for file extension
-               $e = null;
                if ( $path ) {
                        $i = strrpos( $path, '.' );
                        $e = strtolower( $i ? substr( $path, $i + 1 ) : '' );
index caf7e12..3851767 100644 (file)
@@ -145,8 +145,6 @@ abstract class PoolCounterWork {
                        $status = $this->poolCounter->acquireForMe();
                }
                
-               $result = false;
-               
                if ( $status->isOK() ) {
                        switch ( $status->value ) {
                                case PoolCounter::LOCKED:
index c330cdd..9b5d306 100644 (file)
@@ -98,7 +98,7 @@ class Preferences {
                        $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
                        $val = array();
 
-                       foreach ( $options as $label => $value ) {
+                       foreach ( $options as $value ) {
                                if ( $user->getOption( "$prefix$value" ) ) {
                                        $val[] = $value;
                                }
@@ -1218,7 +1218,6 @@ class Preferences {
                                return $tz;
                        default:
                                $data = explode( ':', $tz, 2 );
-                               $minDiff = 0;
                                if ( count( $data ) == 2 ) {
                                        $data[0] = intval( $data[0] );
                                        $data[1] = intval( $data[1] );
index 1f1e999..384a014 100644 (file)
@@ -477,7 +477,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                
                // Collect referenced files
                $files = array();
-               foreach ( $styles as $media => $style ) {
+               foreach ( $styles as $style ) {
                        // Extract and store the list of referenced files
                        $files = array_merge( $files, CSSMin::getLocalFileReferences( $style ) );
                }
@@ -537,13 +537,13 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                
                // Sort of nasty way we can get a flat list of files depended on by all styles
                $styles = array();
-               foreach ( self::organizeFilesByOption( $this->styles, 'media', 'all' ) as $media => $styleFiles ) {
+               foreach ( self::organizeFilesByOption( $this->styles, 'media', 'all' ) as $styleFiles ) {
                        $styles = array_merge( $styles, $styleFiles );
                }
                $skinFiles = (array) self::getSkinFiles(
                        $context->getSkin(), self::organizeFilesByOption( $this->skinStyles, 'media', 'all' )
                );
-               foreach ( $skinFiles as $media => $styleFiles ) {
+               foreach ( $skinFiles as $styleFiles ) {
                        $styles = array_merge( $styles, $styleFiles );
                }
                
index 54709de..7011b73 100644 (file)
@@ -997,7 +997,6 @@ class Revision {
        public static function userCanBitfield( $bitfield, $field ) {
                if( $bitfield & $field ) { // aspect is deleted
                        global $wgUser;
-                       $permission = '';
                        if ( $bitfield & self::DELETED_RESTRICTED ) {
                                $permission = 'suppressrevision';
                        } elseif ( $field & self::DELETED_TEXT ) {
index b87e158..d0a6a7f 100644 (file)
@@ -76,7 +76,6 @@ class RevisionDeleter {
                $lang = $forContent ? $wgContLang : $wgLang;
                $msgFunc = $forContent ? "wfMsgForContent" : "wfMsg";
                
-               $s = '';
                $changes = self::getChanges( $nbitfield, $obitfield );
                array_walk($changes, 'RevisionDeleter::expandMessageArray', $forContent);
                
index 2012588..2a225f6 100644 (file)
@@ -836,7 +836,6 @@ class Skin extends Linker {
                $ret = '<li>';
 
                foreach ( $lines as $line ) {
-                       $m = array();
                        $display = ltrim( $line );
                        $ident = strlen( $line ) - strlen( $display );
                        $diff = $ident - $curIdent;
index 0cdcfeb..3dd12de 100644 (file)
@@ -1264,8 +1264,6 @@ class Title {
                                $errors[] = array( 'cant-move-to-user-page' );
                        }
                } elseif ( !$user->isAllowed( $action ) ) {
-                       $return = null;
-
                        // We avoid expensive display logic for quickUserCan's and such
                        $groups = false;
                        if ( !$short ) {
index ec6dad5..9720283 100644 (file)
@@ -863,7 +863,6 @@ class User {
                        return false;
                }
 
-               $passwordCorrect = FALSE;
                $this->mId = $sId;
                if ( !$this->loadFromId() ) {
                        # Not a valid ID, loadFromId has switched the object to anon for us
@@ -1173,7 +1172,6 @@ class User {
                wfProfileIn( __METHOD__ );
 
                $found = false;
-               $host = '';
                // FIXME: IPv6 ???  (http://bugs.php.net/bug.php?id=33170)
                if( IP::isIPv4( $ip ) ) {
                        # Reverse IP, bug 21255
index 366dd88..0c4943d 100644 (file)
@@ -181,7 +181,6 @@ class MediaWiki {
                wfProfileIn( __METHOD__ );
                global $wgContLang, $wgUser;
                $action = $this->getVal( 'Action' );
-               $perferred = $wgContLang->getPreferredVariant( false );
 
                // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
                if( is_null($title) || ( ( $title->getDBkey() == '' ) && ( $title->getInterwiki() == '' ) ) ) {
index 4dfc9e6..b5c2bd3 100644 (file)
@@ -451,7 +451,6 @@ class Xml {
         * @return string
         */
        public static function listDropDown( $name= '', $list = '', $other = '', $selected = '', $class = '', $tabindex = Null ) {
-               $options = '';
                $optgroup = false;
 
                $options = self::option( $other, 'other', $selected === 'other' );
index 7273f2c..2e6f8c1 100644 (file)
@@ -1019,7 +1019,7 @@ EOF;
                }
                // remove primary keys
                foreach ( $args as $ai => $row ) {
-                       foreach ( $keys as $ki => $key ) {
+                       foreach ( $keys as $key ) {
                                if ( $row[$key] == null ) {
                                        unset( $row[$key] );
                                }
@@ -1261,7 +1261,6 @@ EOF;
                        }
                }
 
-
                // DB2 does not have a proper num_rows() function yet, so we must emulate
                // DB2 9.5.4 and the corresponding ibm_db2 driver will introduce
                //  a working one
index 23efcfc..7acb36c 100644 (file)
@@ -405,7 +405,7 @@ class DatabaseMssql extends DatabaseBase {
                }
                unset( $res );
 
-               foreach ( $arrToInsert as $blah => $a ) {
+               foreach ( $arrToInsert as $a ) {
                        // start out with empty identity column, this is so we can return it as a result of the insert logic
                        $sqlPre = '';
                        $sqlPost = '';
@@ -457,7 +457,7 @@ class DatabaseMssql extends DatabaseBase {
                                " INTO $table (" . implode( ',', $keys ) . ") $identityClause VALUES (";
 
                        $first = true;
-                       foreach ( $a as $key => $value ) {
+                       foreach ( $a as $value ) {
                                if ( $first ) {
                                        $first = false;
                                } else {
@@ -1131,11 +1131,12 @@ class MssqlResult {
   }
 
   public function fetch( $mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass' ) {
-       if ( $this->mCursor >= $this->mRowCount || $this->mRowCount == 0 ) return false;
-       $ret = false;
+       if ( $this->mCursor >= $this->mRowCount || $this->mRowCount == 0 ) {
+               return false;
+       }
        $arrNum = array();
        if ( $mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH ) {
-               foreach ( $this->mRows[$this->mCursor] as $key => $value ) {
+               foreach ( $this->mRows[$this->mCursor] as $value ) {
                        $arrNum[] = $value;
                }
        }
index fc5b951..8b06e2e 100644 (file)
@@ -37,7 +37,7 @@ class ORAResult {
                $array_out = array();
                $array_hashes = array();
 
-               foreach ( $array_in as $key => $item ) {
+               foreach ( $array_in as $item ) {
                        $hash = md5( serialize( $item ) );
                        if ( !isset( $array_hashes[$hash] ) ) {
                                $array_hashes[$hash] = $hash;
@@ -531,7 +531,7 @@ class DatabaseOracle extends DatabaseBase {
                wfRestoreWarnings();
 
                if ( isset( $lob ) ) {
-                       foreach ( $lob as $lob_i => $lob_v ) {
+                       foreach ( $lob as $lob_v ) {
                                $lob_v->free();
                        }
                }
@@ -565,7 +565,7 @@ class DatabaseOracle extends DatabaseBase {
 
                // count-alias subselect fields to avoid abigious definition errors
                $i = 0;
-               foreach ( $varMap as $key => &$val ) {
+               foreach ( $varMap as &$val ) {
                        $val = $val . ' field' . ( $i++ );
                }
 
@@ -861,7 +861,6 @@ class DatabaseOracle extends DatabaseBase {
         * @param $field String
         */
        private function fieldInfoMulti( $table, $field ) {
-               $tableWhere = '';
                $field = strtoupper( $field );
                if ( is_array( $table ) ) {
                        $table = array_map( array( &$this, 'tableName' ), $table );
index d3c3eb5..a694734 100644 (file)
@@ -139,12 +139,13 @@ class DatabasePostgres extends DatabaseBase {
 
        function hasConstraint( $name ) {
                global $wgDBmwschema;
-               $SQL = "SELECT 1 FROM pg_catalog.pg_constraint c, pg_catalog.pg_namespace n WHERE c.connamespace = n.oid AND conname = '" . pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $wgDBmwschema ) ."'";
-               return $this->numRows( $res = $this->doQuery( $SQL ) );
+               $SQL = "SELECT 1 FROM pg_catalog.pg_constraint c, pg_catalog.pg_namespace n WHERE c.connamespace = n.oid AND conname = '" .
+                               pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $wgDBmwschema ) ."'";
+               $res = $this->doQuery( $SQL );
+               return $this->numRows( $res );
        }
 
-       static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0 )
-       {
+       static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0 ) {
                return new DatabasePostgres( $server, $user, $password, $dbName, $failFunction, $flags );
        }
 
@@ -215,7 +216,6 @@ class DatabasePostgres extends DatabaseBase {
                        && preg_match( '/^\w+$/', $wgDBts2schema )
                ) {
                        $safeschema = $this->quote_ident( $wgDBmwschema );
-                       $safeschema2 = $this->quote_ident( $wgDBts2schema );
                        $this->doQuery( "SET search_path = $safeschema, $wgDBts2schema, public" );
                }
 
@@ -381,7 +381,6 @@ class DatabasePostgres extends DatabaseBase {
                        // Install plpgsql if needed
                        $this->setup_plpgsql();
 
-                       $superuser = '';
                        return true; // Reconnect as regular user
 
                } // end superuser
index faadb0b..387d405 100644 (file)
@@ -399,7 +399,7 @@ class DatabaseSqlite extends DatabaseBase {
                # SQLite can't handle multi-row inserts, so divide up into multiple single-row inserts
                if ( isset( $a[0] ) && is_array( $a[0] ) ) {
                        $ret = true;
-                       foreach ( $a as $k => $v ) {
+                       foreach ( $a as $v ) {
                                if ( !parent::insert( $table, $v, "$fname/multi-row", $options ) ) {
                                        $ret = false;
                                }
@@ -417,7 +417,7 @@ class DatabaseSqlite extends DatabaseBase {
                # SQLite can't handle multi-row replaces, so divide up into multiple single-row queries
                if ( isset( $rows[0] ) && is_array( $rows[0] ) ) {
                        $ret = true;
-                       foreach ( $rows as $k => $v ) {
+                       foreach ( $rows as $v ) {
                                if ( !parent::replace( $table, $uniqueIndexes, $v, "$fname/multi-row" ) ) {
                                        $ret = false;
                                }
index 0040fe9..8c9e110 100644 (file)
@@ -216,7 +216,6 @@ class LoadBalancer {
                # Scale the configured load ratios according to the dynamic load (if the load monitor supports it)
                $this->getLoadMonitor()->scaleLoads( $nonErrorLoads, $group, $wiki );
 
-               $i = false;
                $laggedSlaveMode = false;
 
                # First try quickly looking through the available servers for a server that
@@ -364,7 +363,7 @@ class LoadBalancer {
         * Returns false if there is no connection open
         */
        function getAnyOpenConnection( $i ) {
-               foreach ( $this->mConns as $type => $conns ) {
+               foreach ( $this->mConns as $conns ) {
                        if ( !empty( $conns[$i] ) ) {
                                return reset( $conns[$i] );
                        }
@@ -824,7 +823,7 @@ class LoadBalancer {
        function commitMasterChanges() {
                // Always 0, but who knows.. :)
                $masterIndex = $this->getWriterIndex();
-               foreach ( $this->mConns as $type => $conns2 ) {
+               foreach ( $this->mConns as $conns2 ) {
                        if ( empty( $conns2[$masterIndex] ) ) {
                                continue;
                        }
index 094258b..ba57656 100644 (file)
@@ -149,7 +149,7 @@ class ForeignAPIRepo extends FileRepo {
 
        function getImageInfo( $data ) {
                if( $data && isset( $data['query']['pages'] ) ) {
-                       foreach( $data['query']['pages'] as $pageid => $info ) {
+                       foreach( $data['query']['pages'] as $info ) {
                                if( isset( $info['imageinfo'][0] ) ) {
                                        return $info['imageinfo'][0];
                                }
index 8dae87c..82f7939 100644 (file)
@@ -232,7 +232,7 @@ class RepoGroup {
                if ( !$this->reposInitialised ) {
                        $this->initialiseRepos();
                }
-               foreach ( $this->foreignRepos as $key => $repo ) {
+               foreach ( $this->foreignRepos as $repo ) {
                        if ( $repo->name == $name)
                                return $repo;
                }
index 3802f95..18f2ed1 100644 (file)
@@ -332,7 +332,6 @@ abstract class CoreInstaller extends Installer {
                foreach( $this->getInstallSteps() as $stepObj ) {
                        $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
                        call_user_func_array( $startCB, array( $step ) );
-                       $status = null;
 
                        # Call our working function
                        if ( is_array( $stepObj ) ) {
index f3b9fd4..60b35ca 100644 (file)
@@ -117,7 +117,6 @@ abstract class Job {
                                return false;
                        }
                }
-               $offset = $row->job_id;
 
                // Try to delete it from the master
                $dbw = wfGetDB( DB_MASTER );
index c9bc05c..26be8b9 100644 (file)
@@ -1129,7 +1129,6 @@ class Parser {
                        return $this->makeFreeExternalLink( $m[0] );
                } elseif ( isset( $m[4] ) && $m[4] !== '' ) {
                        # RFC or PMID
-                       $CssClass = '';
                        if ( substr( $m[0], 0, 3 ) === 'RFC' ) {
                                $keyword = 'RFC';
                                $urlmsg = 'rfcurl';
@@ -3755,7 +3754,6 @@ class Parser {
                $head = array();
                $sublevelCount = array();
                $levelCount = array();
-               $toclevel = 0;
                $level = 0;
                $prevlevel = 0;
                $toclevel = 0;
index 8179cc6..b6a7367 100644 (file)
@@ -107,7 +107,7 @@ class Parser_DiffTest
 
        function setFunctionHook( $id, $callback, $flags = 0 ) {
                $this->init();
-               foreach  ( $this->parsers as $i => $parser ) {
+               foreach  ( $this->parsers as $parser ) {
                        $parser->setFunctionHook( $id, $callback, $flags );
                }
        }
index 9657ada..991f28c 100644 (file)
@@ -546,7 +546,6 @@ class Preprocessor_DOM implements Preprocessor {
 
                                # check for maximum matching characters (if there are 5 closing
                                # characters, we will probably need only 3 - depending on the rules)
-                               $matchingCount = 0;
                                $rule = $rules[$piece->open];
                                if ( $count > $rule['max'] ) {
                                        # The specified maximum exists in the callback array, unless the caller
@@ -591,7 +590,7 @@ class Preprocessor_DOM implements Preprocessor {
                                        $element = "<$name$attr>";
                                        $element .= "<title>$title</title>";
                                        $argIndex = 1;
-                                       foreach ( $parts as $partIndex => $part ) {
+                                       foreach ( $parts as $part ) {
                                                if ( isset( $part->eqpos ) ) {
                                                        $argName = substr( $part->out, 0, $part->eqpos );
                                                        $argValue = substr( $part->out, $part->eqpos + 1 );
index ec600c0..6cb2feb 100644 (file)
@@ -512,7 +512,6 @@ class Preprocessor_Hash implements Preprocessor {
 
                                # check for maximum matching characters (if there are 5 closing
                                # characters, we will probably need only 3 - depending on the rules)
-                               $matchingCount = 0;
                                $rule = $rules[$piece->open];
                                if ( $count > $rule['max'] ) {
                                        # The specified maximum exists in the callback array, unless the caller
@@ -559,7 +558,7 @@ class Preprocessor_Hash implements Preprocessor {
                                        $titleNode->lastChild = $titleAccum->lastNode;
                                        $element->addChild( $titleNode );
                                        $argIndex = 1;
-                                       foreach ( $parts as $partIndex => $part ) {
+                                       foreach ( $parts as $part ) {
                                                if ( isset( $part->eqpos ) ) {
                                                        // Find equals
                                                        $lastNode = false;
index 919ce48..436186f 100644 (file)
@@ -99,7 +99,6 @@ class SpecialBookSources extends SpecialPage {
                return false;
        }
 
-
        /**
         * Trim ISBN and remove characters which aren't required
         *
index 8487694..ad7909f 100644 (file)
@@ -614,7 +614,7 @@ class ContribsPager extends ReverseChronologicalPager {
                        $page->isRedirect() ? array( 'redirect' => 'no' ) : array()
                );
                # Mark current revisions
-               $difftext = $topmarktext = '';
+               $topmarktext = '';
                if( $row->rev_id == $row->page_latest ) {
                        $topmarktext .= '<span class="mw-uctop">' . $this->messages['uctop'] . '</span>';
                        # Add rollback link
index 2fee3f2..67708cf 100644 (file)
@@ -201,7 +201,6 @@ class IPUnblockForm extends SpecialPage {
                        }
                        $ip = $block->getRedactedName();
                } else {
-                       $block = new Block();
                        $ip = trim( $ip );
                        if ( substr( $ip, 0, 1 ) == "#" ) {
                                $id = substr( $ip, 1 );
@@ -484,7 +483,6 @@ class IPUnblockForm extends SpecialPage {
 
                $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) );
 
-               $unblocklink = '';
                $changeblocklink = '';
                $toolLinks = '';
                if ( $wgUser->isAllowed( 'block' ) ) {
index ed48f56..1464110 100644 (file)
@@ -228,7 +228,7 @@ class ImageListPager extends TablePager {
                $queries = parent::getPagingQueries();
                if ( !is_null( $this->mUserName ) ) {
                        # Append the username to the query string
-                       foreach ( $queries as $key => &$query ) {
+                       foreach ( $queries as &$query ) {
                                $query['username'] = $this->mUserName;
                        }
                }
index 96a53c5..c467ae0 100644 (file)
@@ -98,7 +98,6 @@ class SpecialProtectedpages extends SpecialPage {
                        $description_items[] = wfMsg( 'protect-summary-cascade' );
                }
 
-               $expiry_description = '';
                $stxt = '';
 
                if( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) {
index 5e3ad6c..1a54ad2 100644 (file)
@@ -90,7 +90,7 @@ class SpecialProtectedtitles extends SpecialPage {
 
                $description_items[] = $protType;
 
-               $expiry_description = ''; $stxt = '';
+               $stxt = '';
 
                if ( $row->pt_expiry != 'infinity' && strlen($row->pt_expiry) ) {
                        $expiry = Block::decodeExpiry( $row->pt_expiry );
index b3b7d6c..eda52a1 100644 (file)
@@ -301,7 +301,6 @@ class SpecialRevisionMove extends UnlistedSpecialPage {
                                array( 'page_id = ' . $this->mOldTitle->getArticleID() ),
                                __METHOD__
                        );
-                       $deletedOldPage = true;
                } else {
                        # page_latest has to be updated
                        $currentOldPageRev = Revision::newFromId( $this->mOldTitle->getLatestRevID() );
index 3810fcc..f5769aa 100644 (file)
@@ -868,7 +868,7 @@ class SpecialSearch {
                
                wfRunHooks( 'SpecialSearchProfiles', array( &$profiles ) );
 
-               foreach( $profiles as $key => &$data ) {
+               foreach( $profiles as &$data ) {
                        sort($data['namespaces']);
                }
                
index 24081ff..cfc93a3 100644 (file)
@@ -368,7 +368,6 @@ class SpecialUpload extends SpecialPage {
                $warningHtml = '<h2>' . wfMsgHtml( 'uploadwarning' ) . "</h2>\n"
                        . '<ul class="warning">';
                foreach( $warnings as $warning => $args ) {
-                       $msg = '';
                        if( $warning == 'exists' ) {
                                $msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n";
                        } elseif( $warning == 'duplicate' ) {
@@ -777,7 +776,7 @@ class UploadForm extends HTMLForm {
 
                # Build a list of IDs for javascript insertion
                $this->mSourceIds = array();
-               foreach ( $sourceDescriptor as $key => $field ) {
+               foreach ( $sourceDescriptor as $field ) {
                        if ( !empty( $field['id'] ) ) {
                                $this->mSourceIds[] = $field['id'];
                        }
index fa605ab..904d956 100644 (file)
@@ -2387,7 +2387,7 @@ class Language {
                $tagType = 0; // 0-open, 1-close
                $bracketState = 0; // 1-tag start, 2-tag name, 0-neither
                $entityState = 0; // 0-not entity, 1-entity
-               $tag = $ret = $ch = '';
+               $tag = $ret = '';
                $openTags = array();
                $textLen = strlen( $text );
                for ( $pos = 0; $pos < $textLen; ++$pos ) {
index 7a2d66f..2635243 100644 (file)
@@ -185,7 +185,6 @@ class LanguageConverter {
         */
        protected function getURLVariant() {
                global $wgRequest;
-               $ret = null;
 
                if ( $this->mURLVariant ) {
                        return $this->mURLVariant;
@@ -208,7 +207,6 @@ class LanguageConverter {
         */
        protected function getUserVariant() {
                global $wgUser;
-               $ret = null;
 
                // memoizing this function wreaks havoc on parserTest.php
                /* if ( $this->mUserVariant ) { */
@@ -230,7 +228,6 @@ class LanguageConverter {
                return $this->mUserVariant = $this->validateVariant( $ret );
        }
 
-
        /**
         * Determine the language variant from the Accept-Language header.
         *
@@ -561,7 +558,6 @@ class LanguageConverter {
                        if ( $pos === false ) {
                                // No more markup, append final segment
                                $out .= $this->autoConvert( substr( $text, $startPos ), $variant );
-                               $startPos = $length;
                                return $out;
                        }
 
index 72b4825..e3caacc 100644 (file)
@@ -248,7 +248,6 @@ class KkConverter extends LanguageConverter {
                global $wgLanguageCode;
                $text = parent::translate( $text, $toVariant );
 
-               $letters = '';
                switch( $toVariant ) {
                        case 'kk-cyrl':
                        case 'kk-kz':
index 51749dd..78febae 100644 (file)
@@ -674,7 +674,6 @@ class LanguageKk_cyrl extends Language {
 
        function lastLetter( $word, $allVowels ) {
                $lastLetter = array();
-               $ar = array();
 
                // Put the word in a form we can play with since we're using UTF-8
                $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
index b52df95..0e4d6f8 100644 (file)
@@ -125,7 +125,7 @@ class DumpInterwiki extends Maintenance {
                        if ( preg_match( '/^\|\s*(.*?)\s*\|\|\s*(.*?)\s*$/', $line, $matches ) ) {
                                $prefix = $wgContLang->lc( $matches[1] );
                                $prefix = str_replace( ' ', '_', $prefix );
-                               $prefix = strtolower( $matches[1] );
+
                                $url = $matches[2];
                                if ( preg_match( '/(wikipedia|wiktionary|wikisource|wikiquote|wikibooks|wikimedia)\.org/', $url ) ) {
                                        $local = 1;
@@ -148,7 +148,6 @@ class DumpInterwiki extends Maintenance {
                        $this->makeLanguageLinks ( $site, "_" . $site->suffix );
                }
 
-
                foreach ( $dblist as $db ) {
                        if ( isset( $this->specials[$db] ) ) {
                                # Special wiki
index 514b9ba..15f80e6 100644 (file)
@@ -72,7 +72,7 @@ class NonScaryGearmanWorker extends Net_Gearman_Worker {
                if (isset($resp['data']['arg']) && 
                        Net_Gearman_Connection::stringLength($resp['data']['arg'])) {
                                $arg = json_decode($resp['data']['arg'], true);
-                       }
+               }
 
                ### START MW DIFFERENT BIT
                if ( $name != 'mw_job' ) {
index e2191ac..3bd94f0 100644 (file)
@@ -30,7 +30,7 @@ class DatabaseLag extends Maintenance {
                                $lags = $lb->getLagTimes();
                                unset( $lags[0] );
                                echo gmdate( 'H:i:s' ) . ' ';
-                               foreach ( $lags as $i => $lag ) {
+                               foreach ( $lags as $lag ) {
                                        printf( "%-12s " , $lag === false ? 'false' : $lag );
                                }
                                echo "\n";
index 13fbdae..d8480c0 100644 (file)
@@ -444,8 +444,8 @@ EOL;
         * @return True if there are any results, false if not.
         */
        protected function isEmpty() {
-               foreach( $this->results as $code => $results ) {
-                       foreach( $results as $check => $messages ) {
+               foreach( $this->results as $results ) {
+                       foreach( $results as $messages ) {
                                if( !empty( $messages ) ) {
                                        return false;
                                }
index 732e715..a8a7f7c 100644 (file)
@@ -38,7 +38,7 @@ class CountMessages extends Maintenance {
                        if ( !preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $baseName, $m ) ) {
                                continue;
                        }
-                       $code = str_replace( '_', '-', strtolower( $m[1] ) );
+
                        $numMessages = $this->getNumMessages( $file );
                        // print "$code: $numMessages\n";
                        $total += $numMessages;
index f63291e..808e9fa 100644 (file)
@@ -64,7 +64,7 @@ class nextJobDB extends Maintenance {
                        $dbsByMaster[$lb->getServerName( 0 )][] = $db;
                }
 
-               foreach ( $dbsByMaster as $master => $dbs ) {
+               foreach ( $dbsByMaster as $dbs ) {
                        $dbConn = wfGetDB( DB_MASTER, array(), $dbs[0] );
                        $stype = $dbConn->addQuotes( $type );
 
index 02707ff..5a06c60 100644 (file)
@@ -52,7 +52,6 @@ class PopulateSha1 extends Maintenance {
                        $res = $dbw->select( 'image', array( 'img_name' ), array( 'img_sha1' => '' ), __METHOD__ );
                }
                $imageTable = $dbw->tableName( 'image' );
-               $oldimageTable = $dbw->tableName( 'oldimage' );
 
                if ( $method == 'pipe' ) {
                        // @fixme kill this and replace with a second unbuffered DB connection.
index e0b6686..b59e4e9 100644 (file)
@@ -71,7 +71,7 @@ class RenameDbPrefix extends Maintenance {
                        // sort of message. Best not to try $row->x stuff...
                        $fields = get_object_vars( $row );
                        // Silly for loop over one field...
-                       foreach ( $fields as $resName => $table ) {
+                       foreach ( $fields as $table ) {
                                // $old should be regexp safe ([a-zA-Z_])
                                $newTable = preg_replace( '/^' . $old . '/', $new, $table );
                                $this->output( "Renaming table $table to $newTable\n" );
index 0324ccf..f5048d8 100644 (file)
@@ -357,7 +357,7 @@ class ParserTest {
        function runTests( $tests ) {
                $ok = true;
 
-               foreach ( $tests as $i => $t ) {
+               foreach ( $tests as $t ) {
                        $result =
                                $this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] );
                        $ok = $ok && $result;
index f101652..5fd84c6 100644 (file)
@@ -15,7 +15,6 @@ class SearchEngineTest extends MediaWikiTestSetup {
        function setup() {
                // Get database type and version
                $dbType    = $this->db->getType();
-               $dbVersion = $this->db->getServerVersion();
 
                // will skip unless mysql or sqlite with FTS
                $dbSupported =
index 9dcd181..76a75c5 100644 (file)
@@ -190,7 +190,7 @@ class UserDupes {
                          HAVING n > 1", $fname );
 
                $list = array();
-               foreach ( $res as $row ) {
+               foreach ( $result as $row ) {
                        $list[] = $row->user_name;
                }
                return $list;
index ccf59fe..b8dc15b 100644 (file)
@@ -100,20 +100,22 @@ class profile_point {
        function display( $expand, $indent = 0.0 ) {
                usort( $this->children, 'compare_point' );
 
-               $extet = '';
-               if ( isset( $expand[$this->name()] ) )
-                       $ex = true;
-               else    $ex = false;
+               $ex = isset( $expand[$this->name()] );
+
                if ( !$ex ) {
                        if ( count( $this->children ) ) {
                                $url = getEscapedProfileUrl( false, false, $expand + array( $this->name() => true ) );
                                $extet = " <a href=\"$url\">[+]</a>";
-                       } else $extet = '';
+                       } else {
+                               $extet = '';
+                       }
                } else {
                        $e = array();
-                       foreach ( $expand as $name => $ep )
-                               if ( $name != $this->name() )
+                       foreach ( $expand as $name => $ep ) {
+                               if ( $name != $this->name() ) {
                                        $e += array( $name => $ep );
+                               }
+                       }
 
                        $extet = " <a href=\"" . getEscapedProfileUrl( false, false, $e ) . "\">[–]</a>";
                }
index 85e9174..6376635 100644 (file)
@@ -328,7 +328,7 @@ if($this->data['copyrightico']) { ?>
                <div class='pBody'>
 <?php   if ( is_array( $cont ) ) { ?>
                        <ul>
-<?php                  foreach($cont as $key => $val) { ?>
+<?php                  foreach($cont as $val) { ?>
                                <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
                                        if ( $val['active'] ) { ?> class="active" <?php }
                                ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
index 16af0c0..12c27ba 100644 (file)
@@ -640,7 +640,7 @@ class VectorTemplate extends QuickTemplate {
        <div class="body">
                <?php if ( is_array( $content ) ): ?>
                <ul>
-               <?php foreach( $content as $key => $val ): ?>
+               <?php foreach( $content as $val ): ?>
                        <li id="<?php echo Sanitizer::escapeId( $val['id'] ) ?>"<?php if ( $val['active'] ): ?> class="active" <?php endif; ?>><a href="<?php echo htmlspecialchars( $val['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( $val['id'] ) ?>><?php echo htmlspecialchars( $val['text'] ) ?></a></li>
                <?php endforeach; ?>
                </ul>
@@ -715,7 +715,7 @@ class VectorTemplate extends QuickTemplate {
 <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('views') ?></h5>
        <ul<?php $this->html('userlangattributes') ?>>
-               <?php foreach ( $this->data['view_urls'] as $key => $link ): ?>
+               <?php foreach ( $this->data['view_urls'] as $link ): ?>
                        <li<?php echo $link['attributes'] ?>><span><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo (array_key_exists('img',$link) ?  '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : htmlspecialchars( $link['text'] ) ) ?></a></span></li>
                <?php endforeach; ?>
        </ul>
@@ -728,7 +728,7 @@ class VectorTemplate extends QuickTemplate {
        <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
        <div class="menu">
                <ul<?php $this->html('userlangattributes') ?>>
-                       <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
+                       <?php foreach ($this->data['action_urls'] as $link ): ?>
                                <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
                        <?php endforeach; ?>
                </ul>
@@ -741,7 +741,7 @@ class VectorTemplate extends QuickTemplate {
 <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('personaltools') ?></h5>
        <ul<?php $this->html('userlangattributes') ?>>
-               <?php foreach($this->data['personal_urls'] as $key => $item): ?>
+               <?php foreach($this->data['personal_urls'] as $item): ?>
                        <li <?php echo $item['attributes'] ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php echo $item['key'] ?><?php if(!empty($item['class'])): ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php endif; ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
                <?php endforeach; ?>
        </ul>