Do text normalization in dumpTextPass rather than fetchText, to ensure that the force...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Nov 2007 17:34:42 +0000 (17:34 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Nov 2007 17:34:42 +0000 (17:34 +0000)
maintenance/dumpTextPass.php
maintenance/fetchText.php

index bb7bd61..827c493 100644 (file)
@@ -132,6 +132,10 @@ class TextPassDumper extends BackupDumper {
                if( WikiError::isError( $result ) ) {
                        wfDie( $result->getMessage() );
                }
+               
+               if( $this->spawnProc ) {
+                       $this->closeSpawn();
+               }
 
                $this->report( true );
        }
@@ -362,6 +366,7 @@ class TextPassDumper extends BackupDumper {
        }
        
        private function closeSpawn() {
+               wfSuppressWarnings();
                if( $this->spawnRead )
                        fclose( $this->spawnRead );
                $this->spawnRead = false;
@@ -374,6 +379,7 @@ class TextPassDumper extends BackupDumper {
                if( $this->spawnProc )
                        pclose( $this->spawnProc );
                $this->spawnProc = false;
+               wfRestoreWarnings();
        }
        
        private function getTextSpawnedOnce( $id ) {
@@ -405,7 +411,10 @@ class TextPassDumper extends BackupDumper {
                        return false;
                }
                
-               return $text;
+               // Do normalization in the dump thread...
+               $stripped = str_replace( "\r", "", $text );
+               $normalized = UtfNormal::cleanUp( $stripped );
+               return $normalized;
        }
 
        function startElement( $parser, $name, $attribs ) {
index 38ba3fb..3b745c0 100644 (file)
@@ -29,9 +29,7 @@ function doGetText( $db, $id ) {
        if( $text === false ) {
                return false;
        }
-       $stripped = str_replace( "\r", "", $text );
-       $normalized = UtfNormal::cleanUp( $stripped );
-       return $normalized;
+       return $text;
 }