From 1c64a0cce023cf2aeeb991d7a1912793987dce2a Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 1 Jan 2012 23:35:08 +0000 Subject: [PATCH] Cleanup a few unused variables Mainly indexes in foreach loops --- includes/EditPage.php | 1 - includes/filerepo/backend/FSFileBackend.php | 2 +- includes/filerepo/backend/FileBackend.php | 2 +- includes/filerepo/backend/FileBackendMultiWrite.php | 4 ++-- includes/filerepo/backend/lockmanager/LSLockManager.php | 4 ++-- includes/specials/SpecialDeletedContributions.php | 2 -- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index cd6c6ca629..c895048dac 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1818,7 +1818,6 @@ class EditPage { } if ( $this->section != '' && $this->section != 'new' ) { - $matches = array(); if ( !$this->summary && !$this->preview && !$this->diff ) { $sectionTitle = self::extractSectionTitle( $this->textbox1 ); if ( $sectionTitle !== false ) { diff --git a/includes/filerepo/backend/FSFileBackend.php b/includes/filerepo/backend/FSFileBackend.php index eccc1cf5f3..d6da45e4ac 100644 --- a/includes/filerepo/backend/FSFileBackend.php +++ b/includes/filerepo/backend/FSFileBackend.php @@ -26,7 +26,7 @@ class FSFileBackend extends FileBackend { function __construct( array $config ) { parent::__construct( $config ); $this->containerPaths = (array)$config['containerPaths']; - foreach ( $this->containerPaths as $container => &$path ) { + foreach ( $this->containerPaths as &$path ) { if ( substr( $path, -1 ) === '/' ) { $path = substr( $path, 0, -1 ); // remove trailing slash } diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index c3c81412d7..053662b4c2 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -813,7 +813,7 @@ abstract class FileBackend extends FileBackendBase { if ( empty( $opts['nonLocking'] ) ) { // Build up a list of files to lock... $filesLockEx = $filesLockSh = array(); - foreach ( $performOps as $index => $fileOp ) { + foreach ( $performOps as $fileOp ) { $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() ); $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() ); } diff --git a/includes/filerepo/backend/FileBackendMultiWrite.php b/includes/filerepo/backend/FileBackendMultiWrite.php index 58225fd2f0..114424c2db 100644 --- a/includes/filerepo/backend/FileBackendMultiWrite.php +++ b/includes/filerepo/backend/FileBackendMultiWrite.php @@ -83,7 +83,7 @@ class FileBackendMultiWrite extends FileBackendBase { // Set "files to lock" from the first batch so we don't try to set all // locks two or three times over (depending on the number of backends). // A lock on one storage path is a lock on all the backends. - foreach ( $performOps as $index => $fileOp ) { + foreach ( $performOps as $fileOp ) { $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() ); $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() ); } @@ -297,7 +297,7 @@ class FileBackendMultiWrite extends FileBackendBase { * @see FileBackendBase::getFileList() */ function getFileList( array $params ) { - foreach ( $this->backends as $index => $backend ) { + foreach ( $this->backends as $backend ) { # Get results from the first backend $realParams = $this->substOpPaths( $params, $backend ); return $backend->getFileList( $realParams ); diff --git a/includes/filerepo/backend/lockmanager/LSLockManager.php b/includes/filerepo/backend/lockmanager/LSLockManager.php index 5ae51b1a05..45ccaaeb55 100644 --- a/includes/filerepo/backend/lockmanager/LSLockManager.php +++ b/includes/filerepo/backend/lockmanager/LSLockManager.php @@ -207,7 +207,7 @@ class LSLockManager extends LockManager { $votesLeft = count( $this->srvsByBucket[$bucket] ); // remaining peers $quorum = floor( $votesLeft/2 + 1 ); // simple majority // Get votes for each peer, in order, until we have enough... - foreach ( $this->srvsByBucket[$bucket] as $index => $lockSrv ) { + foreach ( $this->srvsByBucket[$bucket] as $lockSrv ) { // Attempt to acquire the lock on this peer if ( !$this->doLockingRequest( $lockSrv, $paths, $type ) ) { return 'cantacquire'; // vetoed; resource locked @@ -284,7 +284,7 @@ class LSLockManager extends LockManager { */ function __destruct() { $this->releaseLocks(); - foreach ( $this->conns as $lockSrv => $conn ) { + foreach ( $this->conns as $conn ) { fclose( $conn ); } } diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 5e30efc8a5..820884436f 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -293,8 +293,6 @@ class DeletedContributionsPage extends SpecialPage { $out->addHTML( $this->getForm( '' ) ); return; } - $nt = $userObj->getUserPage(); - $id = $userObj->getID(); $target = $userObj->getName(); $out->addSubtitle( $this->getSubTitle( $userObj ) ); -- 2.20.1