Remove some unreachable code (usually returns after throwing exceptions)
authorSam Reed <reedy@users.mediawiki.org>
Tue, 24 Aug 2010 22:03:18 +0000 (22:03 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 24 Aug 2010 22:03:18 +0000 (22:03 +0000)
Fixup call of method after return in DatabaseMssql by using a temp

includes/Hooks.php
includes/MagicWord.php
includes/Namespace.php
includes/db/DatabaseMssql.php
includes/filerepo/ArchivedFile.php
includes/filerepo/ForeignAPIFile.php
includes/media/PNGMetadataExtractor.php
includes/specials/SpecialResetpass.php
maintenance/tests/SearchEngineTest.php

index 37e4e41..168f4bd 100644 (file)
@@ -46,12 +46,10 @@ function wfRunHooks($event, $args = array()) {
 
        if (!is_array($wgHooks)) {
                throw new MWException("Global hooks array is not an array!\n");
-               return false;
        }
 
        if (!is_array($wgHooks[$event])) {
                throw new MWException("Hooks array for event '$event' is not an array!\n");
-               return false;
        }
 
        foreach ($wgHooks[$event] as $index => $hook) {
index a0bcd8c..cd9769e 100644 (file)
@@ -648,7 +648,6 @@ class MagicWordArray {
                }
                // This shouldn't happen either
                throw new MWException( __METHOD__.': parameter not found' );
-               return array( false, false );
        }
 
        /**
index 87fda8c..48a93dd 100644 (file)
@@ -117,7 +117,6 @@ class MWNamespace {
                return isset( $nslist[$index] );
        }
 
-
        /**
         * Returns array of all defined namespaces with their canonical
         * (English) names.
index c25c4d8..67bb353 100644 (file)
@@ -286,8 +286,9 @@ class DatabaseMssql extends DatabaseBase {
                $sql = $this->selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
                if ( isset( $options['EXPLAIN'] ) ) {
                        sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL ON;" );
-                       return $this->query( $sql, $fname );
+                       $ret = $this->query( $sql, $fname );
                        sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL OFF;" );
+            return $ret;
                }
                return $this->query( $sql, $fname );
        }
index ffc0630..368a561 100644 (file)
@@ -140,7 +140,6 @@ class ArchivedFile
                        $this->deleted = $row->fa_deleted;
                } else {
                        throw new MWException( 'This title does not correspond to an image page.' );
-                       return;
                }
                $this->dataLoaded = true;
                $this->exists = true;
index c00fcd8..7c33a49 100644 (file)
@@ -63,7 +63,7 @@ class ForeignAPIFile extends File {
                                $this->getName(),
                                isset( $params['width'] ) ? $params['width'] : -1,
                                isset( $params['height'] ) ? $params['height'] : -1 );
-               return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );;
+               return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params );
        }
 
        // Info we can get from API...
index 490abea..1c9add9 100644 (file)
@@ -45,23 +45,31 @@ class PNGMetadataExtractor {
                // Read chunks
                while( !feof( $fh ) ) {
                        $buf = fread( $fh, 4 );
-                       if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
+                       if( !$buf ) {
+                throw new Exception( __METHOD__ . ": Read error" );
+            }
                        $chunk_size = unpack( "N", $buf);
                        $chunk_size = $chunk_size[1];
 
                        $chunk_type = fread( $fh, 4 );
-                       if( !$chunk_type ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
+                       if( !$chunk_type ) {
+                throw new Exception( __METHOD__ . ": Read error" );
+            }
 
                        if ( $chunk_type == "acTL" ) {
                                $buf = fread( $fh, $chunk_size );
-                               if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
+                               if( !$buf ) {
+                    throw new Exception( __METHOD__ . ": Read error" );
+                }
 
                                $actl = unpack( "Nframes/Nplays", $buf );
                                $frameCount = $actl['frames'];
                                $loopCount = $actl['plays'];
                        } elseif ( $chunk_type == "fcTL" ) {
                                $buf = fread( $fh, $chunk_size );
-                               if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
+                               if( !$buf ) {
+                    throw new Exception( __METHOD__ . ": Read error" );
+                }
                                $buf = substr( $buf, 20 );      
 
                                $fctldur = unpack( "ndelay_num/ndelay_den", $buf );
index cf0761f..f4893ba 100644 (file)
@@ -222,7 +222,6 @@ class SpecialResetpass extends SpecialPage {
                } catch( PasswordError $e ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
                        throw new PasswordError( $e->getMessage() );
-                       return;
                }
                
                $user->setCookies();
index d155eeb..47d03e2 100644 (file)
@@ -35,11 +35,11 @@ class SearchEngineTest extends MediaWikiTestSetup {
 
        function removeSearchData() {
             return;
-            while ( count( $this->pageList ) ) {
+            /*while ( count( $this->pageList ) ) {
                 list( $title, $id ) = array_pop( $this->pageList );
                 $article = new Article( $title, $id );
                 $article->doDeleteArticle( "Search Test" );
-            }
+            }*/
        }
 
        function fetchIds( $results ) {