r107791 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107790‎ | r107791 | r107792 >
Date:23:35, 1 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Cleanup a few unused variables

Mainly indexes in foreach loops
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FSFileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -83,7 +83,7 @@
8484 // Set "files to lock" from the first batch so we don't try to set all
8585 // locks two or three times over (depending on the number of backends).
8686 // A lock on one storage path is a lock on all the backends.
87 - foreach ( $performOps as $index => $fileOp ) {
 87+ foreach ( $performOps as $fileOp ) {
8888 $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
8989 $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
9090 }
@@ -297,7 +297,7 @@
298298 * @see FileBackendBase::getFileList()
299299 */
300300 function getFileList( array $params ) {
301 - foreach ( $this->backends as $index => $backend ) {
 301+ foreach ( $this->backends as $backend ) {
302302 # Get results from the first backend
303303 $realParams = $this->substOpPaths( $params, $backend );
304304 return $backend->getFileList( $realParams );
Index: trunk/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php
@@ -207,7 +207,7 @@
208208 $votesLeft = count( $this->srvsByBucket[$bucket] ); // remaining peers
209209 $quorum = floor( $votesLeft/2 + 1 ); // simple majority
210210 // Get votes for each peer, in order, until we have enough...
211 - foreach ( $this->srvsByBucket[$bucket] as $index => $lockSrv ) {
 211+ foreach ( $this->srvsByBucket[$bucket] as $lockSrv ) {
212212 // Attempt to acquire the lock on this peer
213213 if ( !$this->doLockingRequest( $lockSrv, $paths, $type ) ) {
214214 return 'cantacquire'; // vetoed; resource locked
@@ -284,7 +284,7 @@
285285 */
286286 function __destruct() {
287287 $this->releaseLocks();
288 - foreach ( $this->conns as $lockSrv => $conn ) {
 288+ foreach ( $this->conns as $conn ) {
289289 fclose( $conn );
290290 }
291291 }
Index: trunk/phase3/includes/filerepo/backend/FSFileBackend.php
@@ -26,7 +26,7 @@
2727 function __construct( array $config ) {
2828 parent::__construct( $config );
2929 $this->containerPaths = (array)$config['containerPaths'];
30 - foreach ( $this->containerPaths as $container => &$path ) {
 30+ foreach ( $this->containerPaths as &$path ) {
3131 if ( substr( $path, -1 ) === '/' ) {
3232 $path = substr( $path, 0, -1 ); // remove trailing slash
3333 }
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -813,7 +813,7 @@
814814 if ( empty( $opts['nonLocking'] ) ) {
815815 // Build up a list of files to lock...
816816 $filesLockEx = $filesLockSh = array();
817 - foreach ( $performOps as $index => $fileOp ) {
 817+ foreach ( $performOps as $fileOp ) {
818818 $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
819819 $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
820820 }
Index: trunk/phase3/includes/EditPage.php
@@ -1818,7 +1818,6 @@
18191819 }
18201820
18211821 if ( $this->section != '' && $this->section != 'new' ) {
1822 - $matches = array();
18231822 if ( !$this->summary && !$this->preview && !$this->diff ) {
18241823 $sectionTitle = self::extractSectionTitle( $this->textbox1 );
18251824 if ( $sectionTitle !== false ) {
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -293,8 +293,6 @@
294294 $out->addHTML( $this->getForm( '' ) );
295295 return;
296296 }
297 - $nt = $userObj->getUserPage();
298 - $id = $userObj->getID();
299297
300298 $target = $userObj->getName();
301299 $out->addSubtitle( $this->getSubTitle( $userObj ) );

Status & tagging log