From: Bartosz DziewoƄski Date: Tue, 13 Dec 2016 14:11:43 +0000 (+0100) Subject: Do not lose message parameters in UploadFromChunks::verifyChunk() X-Git-Tag: 1.31.0-rc.0~4610 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=e9dc2bd5f18d92926e798e1ce674931241e21149;p=lhc%2Fweb%2Fwiklou.git Do not lose message parameters in UploadFromChunks::verifyChunk() This code is gross, and my changes do not really make it better, but it works more correctly more often. Bug: T147720 Change-Id: If9ce05045ada1e3f55e031639e4c4ebc2a216de8 --- diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 08cf434d47..449fc05ec4 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -222,7 +222,7 @@ class UploadFromChunks extends UploadFromFile { $this->verifyChunk(); $this->mTempPath = $oldTemp; } catch ( UploadChunkVerificationException $e ) { - return Status::newFatal( $e->getMessage() ); + return Status::newFatal( $e->msg ); } $status = $this->outputChunk( $chunkPath ); if ( $status->isGood() ) { @@ -364,7 +364,7 @@ class UploadFromChunks extends UploadFromFile { $this->mDesiredDestName = $oldDesiredDestName; $this->mTitle = false; if ( is_array( $res ) ) { - throw new UploadChunkVerificationException( $res[0] ); + throw new UploadChunkVerificationException( $res ); } } } @@ -376,4 +376,10 @@ class UploadChunkFileException extends MWException { } class UploadChunkVerificationException extends MWException { + public $msg; + public function __construct( $res ) { + $this->msg = call_user_func_array( 'wfMessage', $res ); + parent::__construct( call_user_func_array( 'wfMessage', $res ) + ->inLanguage( 'en' )->useDatabase( false )->text() ); + } }