More unused variables
authorSam Reed <reedy@users.mediawiki.org>
Tue, 30 Nov 2010 18:44:50 +0000 (18:44 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 30 Nov 2010 18:44:50 +0000 (18:44 +0000)
23 files changed:
includes/ConfEditor.php
includes/GlobalFunctions.php
includes/ImagePage.php
includes/MagicWord.php
includes/SiteConfiguration.php
includes/SquidPurgeClient.php
includes/StubObject.php
includes/Wiki.php
includes/db/DatabaseMysql.php
includes/db/LBFactory_Multi.php
includes/media/SVGMetadataExtractor.php
includes/specials/SpecialAllpages.php
includes/specials/SpecialLinkSearch.php
includes/specials/SpecialSearch.php
includes/specials/SpecialWatchlist.php
includes/upload/UploadBase.php
includes/upload/UploadStash.php
maintenance/fixSlaveDesync.php
maintenance/reassignEdits.php
maintenance/storage/checkStorage.php
maintenance/tests/parser/parserTest.inc
maintenance/tests/phpunit/includes/api/ApiUploadTest.php
maintenance/tests/phpunit/includes/api/RandomImageGenerator.php

index f240628..b08b77d 100644 (file)
@@ -176,7 +176,7 @@ class ConfEditor {
                                // Has it got a comma already?
                                if ( strpos( $lastEltPath, '@extra' ) === false && !$lastEltInfo['hasComma'] ) {
                                        // No comma, insert one after the value region
-                                       list( $start, $end ) = $this->findValueRegion( $lastEltPath );
+                                       list( , $end ) = $this->findValueRegion( $lastEltPath );
                                        $this->replaceSourceRegion( $end - 1, $end - 1, ',' );
                                }
 
@@ -184,7 +184,7 @@ class ConfEditor {
                                list( $start, $end ) = $this->findDeletionRegion( $lastEltPath );
 
                                if ( $key === null ) {
-                                       list( $indent, $arrowIndent ) = $this->getIndent( $start );
+                                       list( $indent, ) = $this->getIndent( $start );
                                        $textToInsert = "$indent$value,";
                                } else {
                                        list( $indent, $arrowIndent ) = 
@@ -202,12 +202,12 @@ class ConfEditor {
                                if ( $firstEltPath === false ) {
                                        throw new MWException( "Can't find array element of \"$path\"" );
                                }
-                               list( $start, $end ) = $this->findDeletionRegion( $firstEltPath );
+                               list( $start, ) = $this->findDeletionRegion( $firstEltPath );
                                $info = $this->pathInfo[$firstEltPath];
 
                                // Make the text to insert
                                if ( $key === null ) {
-                                       list( $indent, $arrowIndent ) = $this->getIndent( $start );
+                                       list( $indent, ) = $this->getIndent( $start );
                                        $textToInsert = "$indent$value,";
                                } else {
                                        list( $indent, $arrowIndent ) = 
index 0e977ba..43c8932 100644 (file)
@@ -214,7 +214,7 @@ function wfArrayDiff2_cmp( $a, $b ) {
        } else {
                reset( $a );
                reset( $b );
-               while( ( list( $keyA, $valueA ) = each( $a ) ) && ( list( $keyB, $valueB ) = each( $b ) ) ) {
+               while( ( list( , $valueA ) = each( $a ) ) && ( list( , $valueB ) = each( $b ) ) ) {
                        $cmp = strcmp( $valueA, $valueB );
                        if ( $cmp !== 0 ) {
                                return $cmp;
index e239a79..6676ea8 100644 (file)
@@ -299,7 +299,6 @@ class ImagePage extends Article {
 
                $this->loadFile();
 
-               $full_url  = $this->displayImg->getURL();
                $sizeSel = intval( $wgUser->getOption( 'imagesize' ) );
                if ( !isset( $wgImageLimits[$sizeSel] ) ) {
                        $sizeSel = User::getDefaultOption( 'imagesize' );
index cd9769e..4698960 100644 (file)
@@ -720,7 +720,7 @@ class MagicWordArray {
                                continue;
                        }
                        if ( preg_match( $regex, $text, $m ) ) {
-                               list( $id, $param ) = $this->parseMatch( $m );
+                               list( $id, ) = $this->parseMatch( $m );
                                if ( strlen( $m[0] ) >= strlen( $text ) ) {
                                        $text = '';
                                } else {
index db2910d..f4a4576 100644 (file)
@@ -293,8 +293,9 @@ class SiteConfiguration {
 
                $ret = call_user_func_array( $this->siteParamsCallback, array( $this, $wiki ) );
                # Validate the returned value
-               if( !is_array( $ret ) )
+               if( !is_array( $ret ) ) {
                        return $default;
+               }
 
                foreach( $default as $name => $def ){
                        if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) )
index 65da5c1..1b315e5 100644 (file)
@@ -265,7 +265,7 @@ class SquidPurgeClient {
                        $this->markDown();
                        return;
                }
-               list( $all, $major, $minor, $status, $reason ) = $m;
+               list( , , , $status, $reason ) = $m;
                $status = intval( $status );
                if ( $status !== 200 && $status !== 404 ) {
                        $this->log( "unexpected status code: $status $reason" );
@@ -356,12 +356,12 @@ class SquidPurgeClientPool {
                        }
 
                        foreach ( $readSockets as $key => $socket ) {
-                               list( $clientIndex, $i ) = explode( '/', $key );
+                               list( $clientIndex, ) = explode( '/', $key );
                                $client = $this->clients[$clientIndex];
                                $client->doReads();
                        }
                        foreach ( $writeSockets as $key => $socket ) {
-                               list( $clientIndex, $i ) = explode( '/', $key );
+                               list( $clientIndex, ) = explode( '/', $key );
                                $client = $this->clients[$clientIndex];
                                $client->doWrites();
                        }
index ef2d973..299bfce 100644 (file)
@@ -100,7 +100,7 @@ class StubObject {
                                throw new MWException( "Unstub loop detected on call of \${$this->mGlobal}->$name from $caller\n" );
                        }
                        wfDebug( "Unstubbing \${$this->mGlobal} on call of \${$this->mGlobal}::$name from $caller\n" );
-                       $obj = $GLOBALS[$this->mGlobal] = $this->_newObject();
+                       $GLOBALS[$this->mGlobal] = $this->_newObject();
                        --$recursionLevel;
                        wfProfileOut( $fname );
                }
index feebcde..e961090 100644 (file)
@@ -108,7 +108,7 @@ class MediaWiki {
                if( $wgRequest->getVal( 'printable' ) === 'yes' ) {
                        $wgOut->setPrintable();
                }
-               $ret = null;
+
                $curid = $wgRequest->getInt( 'curid' );
                if( $curid ) {
                        // URLs like this are generated by RC, because rc_title isn't always accurate
index 07fcdd7..bc41cb1 100644 (file)
@@ -90,7 +90,6 @@ class DatabaseMysql extends DatabaseBase {
                        wfDebug( "DB connection error\n" );
                        wfDebug( "Server: $server, User: $user, Password: " .
                                substr( $password, 0, 3 ) . "..., error: " . mysql_error() . "\n" );
-                       $success = false;
                }
 
                wfProfileOut("dbconnect-$server");
index 3089bd7..0d411ec 100644 (file)
@@ -99,7 +99,7 @@ class LBFactory_Multi extends LBFactory {
        }
 
        function newMainLB( $wiki = false ) {
-               list( $dbName, $prefix ) = $this->getDBNameAndPrefix( $wiki );
+               list( $dbName, ) = $this->getDBNameAndPrefix( $wiki );
                $section = $this->getSectionForWiki( $wiki );
                $groupLoads = array();
                if ( isset( $this->groupLoadsByDB[$dbName] ) ) {
index a46d838..93654fa 100644 (file)
@@ -130,7 +130,6 @@ class SVGReader {
                $keepReading = $this->reader->read();
                while( $keepReading ) {
                        if( $this->reader->name == $name && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
-                               $keepReading = false;
                                break;
                        } elseif( $this->reader->nodeType == XmlReader::TEXT ){
                                $this->metadata[$metafield] = $this->reader->value;
@@ -169,9 +168,8 @@ class SVGReader {
                while( $keepReading ) {
                        if( $this->reader->name == $name && $this->reader->depth <= $exitDepth
                                && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
-                               $keepReading = false;
                                break;
-                       } elseif( $this->reader->nodeType == XmlReader::ELEMENT ){
+                       } elseif ( $this->reader->nodeType == XmlReader::ELEMENT ) {
                                switch( $this->reader->name ) {
                                        case 'animate':
                                        case 'set':
index 487d44d..7bb9cdd 100644 (file)
@@ -307,7 +307,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                        $namespace = NS_MAIN;
                } else {
                        list( $namespace, $fromKey, $from ) = $fromList;
-                       list( $namespace2, $toKey, $to ) = $toList;
+                       list( , $toKey, $to ) = $toList;
 
                        $dbr = wfGetDB( DB_SLAVE );
                        $conds = array(
index ff76c70..124ede1 100644 (file)
@@ -179,7 +179,7 @@ class LinkSearchPage extends QueryPage {
         */
        function doQuery( $offset, $limit, $shownavigation=true ) {
                global $wgOut;
-               list( $this->mMungedQuery, $clause ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
+               list( $this->mMungedQuery,  ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
                if( $this->mMungedQuery === false ) {
                        $wgOut->addWikiMsg( 'linksearch-error' );
                } else {
index 2a0c9ef..e82e8f4 100644 (file)
@@ -341,7 +341,6 @@ class SpecialSearch {
        protected function setupPage( $term ) {
                global $wgOut;
                // Figure out the active search profile header
-               $nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
                if( $this->searchAdvanced ) {
                        $this->active = 'advanced';
                } else {
index 4b622ba..b64af98 100644 (file)
@@ -174,9 +174,7 @@ function wfSpecialWatchlist( $par ) {
        # Possible where conditions
        $conds = array();
 
-       if( $days <= 0 ) {
-               $andcutoff = '';
-       } else {
+       if( $days > 0 ) {
                $conds[] = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'";
        }
 
index 5c970d8..1e3414f 100644 (file)
@@ -440,7 +440,6 @@ abstract class UploadBase {
                $localFile = $this->getLocalFile();
                $filename = $localFile->getName();
                $n = strrpos( $filename, '.' );
-               $partname = $n ? substr( $filename, 0, $n ) : $filename;
 
                /**
                 * Check whether the resulting filename is different from the desired one,
index 89f78b3..94c38c7 100644 (file)
@@ -303,7 +303,7 @@ class UploadStashFile extends UnregisteredLocalFile {
                        return null;
                }
                $extension = $this->getExtension();
-               list( $thumbExt, $thumbMime ) = $this->handler->getThumbType( $extension, $this->getMimeType(), $params );
+               list( $thumbExt, ) = $this->handler->getThumbType( $extension, $this->getMimeType(), $params );
                $thumbName = $this->getHandler()->makeParamString( $params ) . '-' . $urlName;
                if ( $thumbExt != $extension ) {
                        $thumbName .= ".$thumbExt";
index 9605e16..d26c12e 100644 (file)
@@ -41,8 +41,6 @@ class FixSlaveDesync extends Maintenance {
                if ( $this->hasArg() ) {
                        $this->desyncFixPage( $this->getArg() );
                } else {
-                       $dbw = wfGetDB( DB_MASTER );
-                       $maxPage = $dbw->selectField( 'page', 'MAX(page_id)', false, __METHOD__ );
                        $corrupt = $this->findPageLatestCorruption();
                        foreach ( $corrupt as $id => $dummy ) {
                                $this->desyncFixPage( $id );
index 16f9e3f..63e41f4 100644 (file)
@@ -45,7 +45,7 @@ class ReassignEdits extends Maintenance {
                        if ( $to->getId() || $this->hasOption( 'force' ) ) {
                                # Reassign the edits
                                $report = $this->hasOption( 'report' );
-                               $count = $this->doReassignEdits( $from, $to, !$this->hasOption( 'norc' ), $report );
+                               $this->doReassignEdits( $from, $to, !$this->hasOption( 'norc' ), $report );
                                # If reporting, and there were items, advise the user to run without --report   
                                if ( $report ) {
                                        $this->output( "Run the script again without --report to update.\n" );
index d991551..e0b4e80 100644 (file)
@@ -145,7 +145,7 @@ class CheckStorage {
                                                $this->error( 'restore text', "Error: invalid URL \"{$row->old_text}\"", $row->old_id );
                                                continue;
                                        }
-                                       list( $proto, $path ) = $urlParts;
+                                       list( $proto, ) = $urlParts;
                                        if ( $proto != 'DB' ) {
                                                $this->error( 'restore text', "Error: invalid external protocol \"$proto\"", $row->old_id );
                                                continue;
index ac09981..c553550 100644 (file)
@@ -429,7 +429,6 @@ class ParserTest {
                        $titleText = 'Parser test';
                }
 
-               $noxml = isset( $opts['noxml'] );
                $local = isset( $opts['local'] );
                $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
                $parser = $this->getParser( $preprocessor );
index f213dcc..115de86 100644 (file)
@@ -182,7 +182,7 @@ class ApiUploadTest extends ApiTestCase {
                        'lgname' => $user->username, 
                        'lgpassword' => $user->password 
                );
-               list( $result, $request, $session ) = $this->doApiRequest( $params );
+               list( $result, , ) = $this->doApiRequest( $params );
                $this->assertArrayHasKey( "login", $result );
                $this->assertArrayHasKey( "result", $result['login'] );
                $this->assertEquals( "NeedToken", $result['login']['result'] );
@@ -194,7 +194,7 @@ class ApiUploadTest extends ApiTestCase {
                        'lgname' => $user->username,
                        'lgpassword' => $user->password 
                ); 
-               list( $result, $request, $session ) = $this->doApiRequest( $params );
+               list( $result, , $session ) = $this->doApiRequest( $params );
                $this->assertArrayHasKey( "login", $result );
                $this->assertArrayHasKey( "result", $result['login'] );
                $this->assertEquals( "Success", $result['login']['result'] );
@@ -280,7 +280,7 @@ class ApiUploadTest extends ApiTestCase {
 
                $exception = false;
                try {
-                       list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session );
+                       list( $result, , ) = $this->doApiRequestWithToken( $params, $session );
                } catch ( UsageException $e ) {
                        $exception = true;
                }
@@ -324,7 +324,7 @@ class ApiUploadTest extends ApiTestCase {
 
                $exception = false;
                try {
-                       list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session );
+                       $this->doApiRequestWithToken( $params, $session );
                } catch ( UsageException $e ) {
                        $this->assertContains( 'The file you submitted was empty', $e->getMessage() );
                        $exception = true;
@@ -378,7 +378,7 @@ class ApiUploadTest extends ApiTestCase {
 
                $exception = false;
                try {
-                       list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session );
+                       list( $result, , $session ) = $this->doApiRequestWithToken( $params, $session );
                } catch ( UsageException $e ) {
                        $exception = true;
                }
@@ -394,7 +394,7 @@ class ApiUploadTest extends ApiTestCase {
 
                $exception = false;
                try {
-                       list( $result, $request, $session ) = $this->doApiRequestWithToken( $params, $session );
+                       list( $result, , ) = $this->doApiRequestWithToken( $params, $session );
                } catch ( UsageException $e ) {
                        $exception = true;
                }
index f544a71..e16b6c4 100644 (file)
@@ -204,12 +204,10 @@ class RandomImageGenerator {
 
                $command = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " . implode( " ", $args );
                $retval = null;
-               $output = wfShellExec( $command, $retval );
+               wfShellExec( $command, $retval );
                return ( $retval === 0 );
        }
 
-               
-
        /**
         * Generate a string of random colors for ImageMagick, like "rgb(12, 37, 98)"
         *