Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326944 )

Change subject: Do not lose message parameters in 
UploadFromChunks::verifyChunk()
......................................................................

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
---
M includes/upload/UploadFromChunks.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/326944/1

diff --git a/includes/upload/UploadFromChunks.php 
b/includes/upload/UploadFromChunks.php
index 08cf434..e65dc56 100644
--- a/includes/upload/UploadFromChunks.php
+++ b/includes/upload/UploadFromChunks.php
@@ -222,7 +222,7 @@
                                        $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 @@
                $this->mDesiredDestName = $oldDesiredDestName;
                $this->mTitle = false;
                if ( is_array( $res ) ) {
-                       throw new UploadChunkVerificationException( $res[0] );
+                       throw new UploadChunkVerificationException( $res );
                }
        }
 }
@@ -376,4 +376,9 @@
 }
 
 class UploadChunkVerificationException extends MWException {
+       public $msg;
+       public function __construct( $res ) {
+               $this->msg = call_user_func_array( 'wfMessage', $res );
+               parent::__construct( $this->msg->inLanguage( 'en' 
)->useDatabase( false )->text() );
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/326944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9ce05045ada1e3f55e031639e4c4ebc2a216de8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to