Remove FileRepoStatus references
[lhc/web/wiklou.git] / includes / upload / UploadFromChunks.php
index 9145a85..03b9821 100644 (file)
@@ -113,7 +113,7 @@ class UploadFromChunks extends UploadFromFile {
 
        /**
         * Append the final chunk and ready file for parent::performUpload()
-        * @return FileRepoStatus
+        * @return Status
         */
        public function concatenateChunks() {
                $chunkIndex = $this->getChunkIndex();
@@ -130,7 +130,7 @@ class UploadFromChunks extends UploadFromFile {
                // Get the file extension from the last chunk
                $ext = FileBackend::extensionFromPath( $this->mVirtualTempPath );
                // Get a 0-byte temp file to perform the concatenation at
-               $tmpFile = TempFSFile::factory( 'chunkedupload_', $ext );
+               $tmpFile = TempFSFile::factory( 'chunkedupload_', $ext, wfTempDir() );
                $tmpPath = false; // fail in concatenate()
                if ( $tmpFile ) {
                        // keep alive with $this
@@ -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() ) {
@@ -313,7 +313,7 @@ class UploadFromChunks extends UploadFromFile {
         *
         * @param string $chunkPath
         * @throws UploadChunkFileException
-        * @return FileRepoStatus
+        * @return Status
         */
        private function outputChunk( $chunkPath ) {
                // Key is fileKey + chunk index
@@ -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() );
+       }
 }