Merge "Use descriptive key for array of in a Special:EditWatchlist line"
[lhc/web/wiklou.git] / maintenance / importDump.php
index 88e7120..1f75bcc 100644 (file)
@@ -111,6 +111,7 @@ TEXT;
        function setNsfilter( array $namespaces ) {
                if ( count( $namespaces ) == 0 ) {
                        $this->nsFilter = false;
+
                        return;
                }
                $this->nsFilter = array_unique( array_map( array( $this, 'getNsIndex' ), $namespaces ) );
@@ -140,9 +141,9 @@ TEXT;
                } elseif ( $obj instanceof WikiRevision ) {
                        $ns = $obj->title->getNamespace();
                } else {
-                       echo wfBacktrace();
-                       $this->error( "Cannot get namespace of object in " . __METHOD__, true );
+                       throw new MWException( "Cannot get namespace of object in " . __METHOD__ );
                }
+
                return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
        }
 
@@ -157,6 +158,7 @@ TEXT;
                $title = $rev->getTitle();
                if ( !$title ) {
                        $this->progress( "Got bogus revision with null title!" );
+
                        return;
                }
 
@@ -179,7 +181,7 @@ TEXT;
        function handleUpload( $revision ) {
                if ( $this->uploads ) {
                        if ( $this->skippedNamespace( $revision ) ) {
-                               return;
+                               return false;
                        }
                        $this->uploadCount++;
                        // $this->report();
@@ -189,9 +191,12 @@ TEXT;
                                // bluuuh hack
                                // call_user_func( $this->uploadCallback, $revision );
                                $dbw = wfGetDB( DB_MASTER );
+
                                return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
                        }
                }
+
+               return false;
        }
 
        function handleLogItem( $rev ) {
@@ -248,6 +253,7 @@ TEXT;
                }
 
                $file = fopen( $filename, 'rt' );
+
                return $this->importFromHandle( $file );
        }
 
@@ -256,6 +262,7 @@ TEXT;
                if ( self::posix_isatty( $file ) ) {
                        $this->maybeHelp( true );
                }
+
                return $this->importFromHandle( $file );
        }