From 6b3b915353528a15a1e16e6023caaed97f52c144 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 14 Oct 2010 20:53:04 +0000 Subject: [PATCH] Big attack on unused variables... --- config/Installer.php | 3 ++- includes/BagOStuff.php | 1 - includes/ConfEditor.php | 2 +- includes/DistributionRepository.php | 6 ++---- includes/EditPage.php | 1 - includes/HTMLFileCache.php | 9 +++------ includes/HTMLForm.php | 2 +- includes/ImagePage.php | 3 +-- includes/ImportXMLReader.php | 1 - includes/Interwiki.php | 2 +- includes/LogEventsList.php | 5 +---- includes/MessageCache.php | 2 +- includes/MimeMagic.php | 1 - includes/PoolCounter.php | 2 -- includes/Preferences.php | 3 +-- includes/ResourceLoaderModule.php | 6 +++--- includes/Revision.php | 1 - includes/RevisionDelete.php | 1 - includes/Skin.php | 1 - includes/Title.php | 2 -- includes/User.php | 2 -- includes/Wiki.php | 1 - includes/Xml.php | 1 - includes/db/DatabaseIbm_db2.php | 3 +-- includes/db/DatabaseMssql.php | 11 ++++++----- includes/db/DatabaseOracle.php | 7 +++---- includes/db/DatabasePostgres.php | 11 +++++------ includes/db/DatabaseSqlite.php | 4 ++-- includes/db/LoadBalancer.php | 5 ++--- includes/filerepo/ForeignAPIRepo.php | 2 +- includes/filerepo/RepoGroup.php | 2 +- includes/installer/CoreInstaller.php | 1 - includes/job/JobQueue.php | 1 - includes/parser/Parser.php | 2 -- includes/parser/Parser_DiffTest.php | 2 +- includes/parser/Preprocessor_DOM.php | 3 +-- includes/parser/Preprocessor_Hash.php | 3 +-- includes/specials/SpecialBooksources.php | 1 - includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialIpblocklist.php | 2 -- includes/specials/SpecialListfiles.php | 2 +- includes/specials/SpecialProtectedpages.php | 1 - includes/specials/SpecialProtectedtitles.php | 2 +- includes/specials/SpecialRevisionMove.php | 1 - includes/specials/SpecialSearch.php | 2 +- includes/specials/SpecialUpload.php | 3 +-- languages/Language.php | 2 +- languages/LanguageConverter.php | 4 ---- languages/classes/LanguageKk.php | 1 - languages/classes/LanguageKk_cyrl.php | 1 - maintenance/dumpInterwiki.php | 3 +-- maintenance/gearman/gearman.inc | 2 +- maintenance/lag.php | 2 +- maintenance/language/checkLanguage.inc | 4 ++-- maintenance/language/countMessages.php | 2 +- maintenance/nextJobDB.php | 2 +- maintenance/populateSha1.php | 1 - maintenance/renameDbPrefix.php | 2 +- maintenance/tests/parser/parserTest.inc | 2 +- .../phpunit/includes/search/SearchEngineTest.php | 1 - maintenance/userDupes.inc | 2 +- profileinfo.php | 16 +++++++++------- skins/MonoBook.php | 2 +- skins/Vector.php | 8 ++++---- 64 files changed, 71 insertions(+), 117 deletions(-) diff --git a/config/Installer.php b/config/Installer.php index 56323fc55c..e2d0134588 100644 --- a/config/Installer.php +++ b/config/Installer.php @@ -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 ""; diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index d2c95feb30..04900f4981 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -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? diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index a1a3431c20..4bd55ac35f 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -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; diff --git a/includes/DistributionRepository.php b/includes/DistributionRepository.php index f9e255f37a..8aabb51165 100644 --- a/includes/DistributionRepository.php +++ b/includes/DistributionRepository.php @@ -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", diff --git a/includes/EditPage.php b/includes/EditPage.php index d71dfce53f..45abdfcbd3 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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() ) { diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 3b4a886fb9..edae81b6aa 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -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" ); } diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 4184128fa4..1192669f95 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -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 { diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 91fd25db13..06cc5f3762 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -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(); diff --git a/includes/ImportXMLReader.php b/includes/ImportXMLReader.php index 9a9e6c4409..790d1a0d83 100644 --- a/includes/ImportXMLReader.php +++ b/includes/ImportXMLReader.php @@ -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, diff --git a/includes/Interwiki.php b/includes/Interwiki.php index 865119ae57..5a3b655643 100644 --- a/includes/Interwiki.php +++ b/includes/Interwiki.php @@ -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 ) { diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 62c3184ec5..711dec24bd 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -321,7 +321,6 @@ class LogEventsList { } private function logUserLinks( $row ) { - $userLinks = ''; if( self::isDeleted( $row, LogPage::DELETED_USER ) ) { $userLinks = '' . wfMsgHtml( 'rev-deleted-user' ) . ''; @@ -337,7 +336,6 @@ class LogEventsList { } private function logAction( $row, $title, $paramArray ) { - $action = ''; if( self::isDeleted( $row, LogPage::DELETED_ACTION ) ) { $action = '' . wfMsgHtml( 'rev-deleted-event' ) . ''; @@ -350,7 +348,6 @@ class LogEventsList { private function logComment( $row ) { global $wgContLang; - $comment = ''; if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) { $comment = '' . wfMsgHtml( 'rev-deleted-comment' ) . ''; @@ -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 { diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 33b7e4251c..0afb2df3dd 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -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; diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index cde30bc009..d86012c351 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -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 ) : '' ); diff --git a/includes/PoolCounter.php b/includes/PoolCounter.php index caf7e124a0..3851767fad 100644 --- a/includes/PoolCounter.php +++ b/includes/PoolCounter.php @@ -145,8 +145,6 @@ abstract class PoolCounterWork { $status = $this->poolCounter->acquireForMe(); } - $result = false; - if ( $status->isOK() ) { switch ( $status->value ) { case PoolCounter::LOCKED: diff --git a/includes/Preferences.php b/includes/Preferences.php index c330cdd7f8..9b5d306897 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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] ); diff --git a/includes/ResourceLoaderModule.php b/includes/ResourceLoaderModule.php index 1f1e999ca0..384a01491f 100644 --- a/includes/ResourceLoaderModule.php +++ b/includes/ResourceLoaderModule.php @@ -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 ); } diff --git a/includes/Revision.php b/includes/Revision.php index 54709de5a8..7011b73b88 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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 ) { diff --git a/includes/RevisionDelete.php b/includes/RevisionDelete.php index b87e158751..d0a6a7f58e 100644 --- a/includes/RevisionDelete.php +++ b/includes/RevisionDelete.php @@ -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); diff --git a/includes/Skin.php b/includes/Skin.php index 20125889f1..2a225f6316 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -836,7 +836,6 @@ class Skin extends Linker { $ret = '
  • '; foreach ( $lines as $line ) { - $m = array(); $display = ltrim( $line ); $ident = strlen( $line ) - strlen( $display ); $diff = $ident - $curIdent; diff --git a/includes/Title.php b/includes/Title.php index 0cdcfeb016..3dd12de8b9 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ) { diff --git a/includes/User.php b/includes/User.php index ec6dad577f..972028373e 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 diff --git a/includes/Wiki.php b/includes/Wiki.php index 366dd887ea..0c4943d6c4 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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() == '' ) ) ) { diff --git a/includes/Xml.php b/includes/Xml.php index 4dfc9e6f5f..b5c2bd36e1 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -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' ); diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 7273f2c99f..2e6f8c123c 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -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 diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 23efcfceaa..7acb36caa4 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -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; } } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index fc5b951f45..8b06e2eddf 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -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 ); diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index d3c3eb57e5..a694734120 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -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 diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index faadb0bde5..387d4053be 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -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; } diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 0040fe9e15..8c9e110346 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -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; } diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 094258bb24..ba57656b67 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -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]; } diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 8dae87cb52..82f79390e8 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -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; } diff --git a/includes/installer/CoreInstaller.php b/includes/installer/CoreInstaller.php index 3802f95a58..18f2ed12f6 100644 --- a/includes/installer/CoreInstaller.php +++ b/includes/installer/CoreInstaller.php @@ -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 ) ) { diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php index f3b9fd4ae1..60b35cae8c 100644 --- a/includes/job/JobQueue.php +++ b/includes/job/JobQueue.php @@ -117,7 +117,6 @@ abstract class Job { return false; } } - $offset = $row->job_id; // Try to delete it from the master $dbw = wfGetDB( DB_MASTER ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index c9bc05c07d..26be8b9d43 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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; diff --git a/includes/parser/Parser_DiffTest.php b/includes/parser/Parser_DiffTest.php index 8179cc6ea1..b6a7367112 100644 --- a/includes/parser/Parser_DiffTest.php +++ b/includes/parser/Parser_DiffTest.php @@ -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 ); } } diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 9657ada9f2..991f28cc42 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -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"; $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 ); diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index ec600c0cad..6cb2febcbd 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -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; diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index 919ce48261..436186f6a3 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -99,7 +99,6 @@ class SpecialBookSources extends SpecialPage { return false; } - /** * Trim ISBN and remove characters which aren't required * diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 8487694291..ad7909f39b 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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 .= '' . $this->messages['uctop'] . ''; # Add rollback link diff --git a/includes/specials/SpecialIpblocklist.php b/includes/specials/SpecialIpblocklist.php index 2fee3f2f50..67708cffd0 100644 --- a/includes/specials/SpecialIpblocklist.php +++ b/includes/specials/SpecialIpblocklist.php @@ -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' ) ) { diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index ed48f56c70..14641102b2 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -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; } } diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index 96a53c5635..c467ae019e 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -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) ) { diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index 5e3ad6c8f6..1a54ad2ae5 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -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 ); diff --git a/includes/specials/SpecialRevisionMove.php b/includes/specials/SpecialRevisionMove.php index b3b7d6c2fd..eda52a1743 100644 --- a/includes/specials/SpecialRevisionMove.php +++ b/includes/specials/SpecialRevisionMove.php @@ -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() ); diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 3810fcca9d..f5769aaa4d 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -868,7 +868,7 @@ class SpecialSearch { wfRunHooks( 'SpecialSearchProfiles', array( &$profiles ) ); - foreach( $profiles as $key => &$data ) { + foreach( $profiles as &$data ) { sort($data['namespaces']); } diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 24081ffe40..cfc93a3e51 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -368,7 +368,6 @@ class SpecialUpload extends SpecialPage { $warningHtml = '

    ' . wfMsgHtml( 'uploadwarning' ) . "

    \n" . ' @@ -741,7 +741,7 @@ class VectorTemplate extends QuickTemplate {
    msg('personaltools') ?>
    html('userlangattributes') ?>> - data['personal_urls'] as $key => $item): ?> + data['personal_urls'] as $item): ?>
  • > class="">
  • -- 2.20.1