r71592 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71591‎ | r71592 | r71593 >
Date:22:03, 24 August 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Remove some unreachable code (usually returns after throwing exceptions)

Fixup call of method after return in DatabaseMssql by using a temp
Modified paths:
  • /trunk/phase3/includes/Hooks.php (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/Namespace.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ArchivedFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)
  • /trunk/phase3/includes/media/PNGMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialResetpass.php (modified) (history)
  • /trunk/phase3/maintenance/tests/SearchEngineTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/SearchEngineTest.php
@@ -35,11 +35,11 @@
3636
3737 function removeSearchData() {
3838 return;
39 - while ( count( $this->pageList ) ) {
 39+ /*while ( count( $this->pageList ) ) {
4040 list( $title, $id ) = array_pop( $this->pageList );
4141 $article = new Article( $title, $id );
4242 $article->doDeleteArticle( "Search Test" );
43 - }
 43+ }*/
4444 }
4545
4646 function fetchIds( $results ) {
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -286,8 +286,9 @@
287287 $sql = $this->selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
288288 if ( isset( $options['EXPLAIN'] ) ) {
289289 sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL ON;" );
290 - return $this->query( $sql, $fname );
 290+ $ret = $this->query( $sql, $fname );
291291 sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL OFF;" );
 292+ return $ret;
292293 }
293294 return $this->query( $sql, $fname );
294295 }
Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -63,7 +63,7 @@
6464 $this->getName(),
6565 isset( $params['width'] ) ? $params['width'] : -1,
6666 isset( $params['height'] ) ? $params['height'] : -1 );
67 - return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );;
 67+ return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );
6868 }
6969
7070 // Info we can get from API...
Index: trunk/phase3/includes/filerepo/ArchivedFile.php
@@ -140,7 +140,6 @@
141141 $this->deleted = $row->fa_deleted;
142142 } else {
143143 throw new MWException( 'This title does not correspond to an image page.' );
144 - return;
145144 }
146145 $this->dataLoaded = true;
147146 $this->exists = true;
Index: trunk/phase3/includes/Hooks.php
@@ -46,12 +46,10 @@
4747
4848 if (!is_array($wgHooks)) {
4949 throw new MWException("Global hooks array is not an array!\n");
50 - return false;
5150 }
5251
5352 if (!is_array($wgHooks[$event])) {
5453 throw new MWException("Hooks array for event '$event' is not an array!\n");
55 - return false;
5654 }
5755
5856 foreach ($wgHooks[$event] as $index => $hook) {
Index: trunk/phase3/includes/media/PNGMetadataExtractor.php
@@ -45,23 +45,31 @@
4646 // Read chunks
4747 while( !feof( $fh ) ) {
4848 $buf = fread( $fh, 4 );
49 - if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
 49+ if( !$buf ) {
 50+ throw new Exception( __METHOD__ . ": Read error" );
 51+ }
5052 $chunk_size = unpack( "N", $buf);
5153 $chunk_size = $chunk_size[1];
5254
5355 $chunk_type = fread( $fh, 4 );
54 - if( !$chunk_type ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
 56+ if( !$chunk_type ) {
 57+ throw new Exception( __METHOD__ . ": Read error" );
 58+ }
5559
5660 if ( $chunk_type == "acTL" ) {
5761 $buf = fread( $fh, $chunk_size );
58 - if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
 62+ if( !$buf ) {
 63+ throw new Exception( __METHOD__ . ": Read error" );
 64+ }
5965
6066 $actl = unpack( "Nframes/Nplays", $buf );
6167 $frameCount = $actl['frames'];
6268 $loopCount = $actl['plays'];
6369 } elseif ( $chunk_type == "fcTL" ) {
6470 $buf = fread( $fh, $chunk_size );
65 - if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
 71+ if( !$buf ) {
 72+ throw new Exception( __METHOD__ . ": Read error" );
 73+ }
6674 $buf = substr( $buf, 20 );
6775
6876 $fctldur = unpack( "ndelay_num/ndelay_den", $buf );
Index: trunk/phase3/includes/MagicWord.php
@@ -648,7 +648,6 @@
649649 }
650650 // This shouldn't happen either
651651 throw new MWException( __METHOD__.': parameter not found' );
652 - return array( false, false );
653652 }
654653
655654 /**
Index: trunk/phase3/includes/Namespace.php
@@ -117,7 +117,6 @@
118118 return isset( $nslist[$index] );
119119 }
120120
121 -
122121 /**
123122 * Returns array of all defined namespaces with their canonical
124123 * (English) names.
Index: trunk/phase3/includes/specials/SpecialResetpass.php
@@ -222,7 +222,6 @@
223223 } catch( PasswordError $e ) {
224224 wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
225225 throw new PasswordError( $e->getMessage() );
226 - return;
227226 }
228227
229228 $user->setCookies();

Follow-up revisions

RevisionCommit summaryAuthorDate
r71596Fixup whitespace from r71592...reedy22:34, 24 August 2010
r71597Fix those spaces too from r71596/r71592reedy22:36, 24 August 2010

Comments

#Comment by Platonides (talk | contribs)   22:18, 24 August 2010
+            return $ret;
+                throw new Exception( __METHOD__ . ": Read error" ); [the four of them]
+                }

Are using spaces, not tabs

#Comment by Reedy (talk | contribs)   22:29, 24 August 2010

Goddamit.

The IDE seems to have reset preferences. Will fix

Status & tagging log