From e76775e06fb357ea8a44f4ac5ab5c8d75221a018 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 30 Nov 2010 18:44:50 +0000 Subject: [PATCH] More unused variables --- includes/ConfEditor.php | 8 ++++---- includes/GlobalFunctions.php | 2 +- includes/ImagePage.php | 1 - includes/MagicWord.php | 2 +- includes/SiteConfiguration.php | 3 ++- includes/SquidPurgeClient.php | 6 +++--- includes/StubObject.php | 2 +- includes/Wiki.php | 2 +- includes/db/DatabaseMysql.php | 1 - includes/db/LBFactory_Multi.php | 2 +- includes/media/SVGMetadataExtractor.php | 4 +--- includes/specials/SpecialAllpages.php | 2 +- includes/specials/SpecialLinkSearch.php | 2 +- includes/specials/SpecialSearch.php | 1 - includes/specials/SpecialWatchlist.php | 4 +--- includes/upload/UploadBase.php | 1 - includes/upload/UploadStash.php | 2 +- maintenance/fixSlaveDesync.php | 2 -- maintenance/reassignEdits.php | 2 +- maintenance/storage/checkStorage.php | 2 +- maintenance/tests/parser/parserTest.inc | 1 - .../tests/phpunit/includes/api/ApiUploadTest.php | 12 ++++++------ .../phpunit/includes/api/RandomImageGenerator.php | 4 +--- 23 files changed, 28 insertions(+), 40 deletions(-) diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index f240628e15..b08b77df22 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -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 ) = diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0e977bad37..43c8932aa6 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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; diff --git a/includes/ImagePage.php b/includes/ImagePage.php index e239a79c42..6676ea83ad 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -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' ); diff --git a/includes/MagicWord.php b/includes/MagicWord.php index cd9769ed87..4698960b57 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -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 { diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index db2910d29f..f4a4576a5a 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -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] ) ) ) diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index 65da5c1acc..1b315e5f53 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -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(); } diff --git a/includes/StubObject.php b/includes/StubObject.php index ef2d973b62..299bfcef52 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -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 ); } diff --git a/includes/Wiki.php b/includes/Wiki.php index feebcdef77..e961090e16 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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 diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 07fcdd7311..bc41cb1477 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -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"); diff --git a/includes/db/LBFactory_Multi.php b/includes/db/LBFactory_Multi.php index 3089bd7ced..0d411ec6ef 100644 --- a/includes/db/LBFactory_Multi.php +++ b/includes/db/LBFactory_Multi.php @@ -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] ) ) { diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index a46d8389dc..93654fabce 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -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': diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 487d44d3b8..7bb9cddbfe 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -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( diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index ff76c70042..124ede1fcf 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -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 { diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 2a0c9efd47..e82e8f4ed3 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -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 { diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 4b622ba066..b64af98431 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -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 ) )."'"; } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 5c970d8037..1e3414f350 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -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, diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index 89f78b3723..94c38c7884 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -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"; diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php index 9605e161ff..d26c12efc4 100644 --- a/maintenance/fixSlaveDesync.php +++ b/maintenance/fixSlaveDesync.php @@ -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 ); diff --git a/maintenance/reassignEdits.php b/maintenance/reassignEdits.php index 16f9e3fa86..63e41f4f14 100644 --- a/maintenance/reassignEdits.php +++ b/maintenance/reassignEdits.php @@ -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" ); diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php index d991551d10..e0b4e803e2 100644 --- a/maintenance/storage/checkStorage.php +++ b/maintenance/storage/checkStorage.php @@ -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; diff --git a/maintenance/tests/parser/parserTest.inc b/maintenance/tests/parser/parserTest.inc index ac09981332..c553550cad 100644 --- a/maintenance/tests/parser/parserTest.inc +++ b/maintenance/tests/parser/parserTest.inc @@ -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 ); diff --git a/maintenance/tests/phpunit/includes/api/ApiUploadTest.php b/maintenance/tests/phpunit/includes/api/ApiUploadTest.php index f213dcc98b..115de86d0a 100644 --- a/maintenance/tests/phpunit/includes/api/ApiUploadTest.php +++ b/maintenance/tests/phpunit/includes/api/ApiUploadTest.php @@ -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; } diff --git a/maintenance/tests/phpunit/includes/api/RandomImageGenerator.php b/maintenance/tests/phpunit/includes/api/RandomImageGenerator.php index f544a71129..e16b6c4928 100644 --- a/maintenance/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/maintenance/tests/phpunit/includes/api/RandomImageGenerator.php @@ -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)" * -- 2.20.1