From 54fa21ca8242e4389c4c279d98e04f15a7bedc43 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 20 Nov 2007 17:34:42 +0000 Subject: [PATCH] Do text normalization in dumpTextPass rather than fetchText, to ensure that the force-loaded ICU plugin will be used in the parent process. --- maintenance/dumpTextPass.php | 11 ++++++++++- maintenance/fetchText.php | 4 +--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index bb7bd61485..827c49378e 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -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 ) { diff --git a/maintenance/fetchText.php b/maintenance/fetchText.php index 38ba3fb2e9..3b745c0ac1 100644 --- a/maintenance/fetchText.php +++ b/maintenance/fetchText.php @@ -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; } -- 2.20.1