/**
* Append the final chunk and ready file for parent::performUpload()
- * @return FileRepoStatus
+ * @return Status
*/
public function concatenateChunks() {
$chunkIndex = $this->getChunkIndex();
// 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
$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() ) {
*
* @param string $chunkPath
* @throws UploadChunkFileException
- * @return FileRepoStatus
+ * @return Status
*/
private function outputChunk( $chunkPath ) {
// Key is fileKey + chunk index
$this->mDesiredDestName = $oldDesiredDestName;
$this->mTitle = false;
if ( is_array( $res ) ) {
- throw new UploadChunkVerificationException( $res[0] );
+ throw new UploadChunkVerificationException( $res );
}
}
}
}
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() );
+ }
}