X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fupload%2FUploadFromChunks.php;h=68bcb9d9c746b52ee11de291263d2ea9d0b3ff4f;hb=31495b9e60e01438f5906cb24d484599e4930e66;hp=449fc05ec4d62ae824e80caf3df4212e742386e3;hpb=81518f218a4610db96670e1bedff874c65dfec81;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 449fc05ec4..68bcb9d9c7 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -63,6 +63,52 @@ class UploadFromChunks extends UploadFromFile { } } + /** + * @inheritDoc + */ + public function tryStashFile( User $user, $isPartial = false ) { + try { + $this->verifyChunk(); + } catch ( UploadChunkVerificationException $e ) { + return Status::newFatal( $e->msg ); + } + + return parent::tryStashFile( $user, $isPartial ); + } + + /** + * @inheritDoc + * @throws UploadChunkVerificationException + * @deprecated since 1.28 Use tryStashFile() instead + */ + public function stashFile( User $user = null ) { + wfDeprecated( __METHOD__, '1.28' ); + $this->verifyChunk(); + return parent::stashFile( $user ); + } + + /** + * @inheritDoc + * @throws UploadChunkVerificationException + * @deprecated since 1.28 + */ + public function stashFileGetKey() { + wfDeprecated( __METHOD__, '1.28' ); + $this->verifyChunk(); + return parent::stashFileGetKey(); + } + + /** + * @inheritDoc + * @throws UploadChunkVerificationException + * @deprecated since 1.28 + */ + public function stashSession() { + wfDeprecated( __METHOD__, '1.28' ); + $this->verifyChunk(); + return parent::stashSession(); + } + /** * Calls the parent doStashFile and updates the uploadsession table to handle "chunks" * @@ -74,7 +120,6 @@ class UploadFromChunks extends UploadFromFile { $this->mChunkIndex = 0; $this->mOffset = 0; - $this->verifyChunk(); // Create a local stash target $this->mStashFile = parent::doStashFile( $user ); // Update the initial file offset (based on file size) @@ -113,7 +158,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(); @@ -313,7 +358,7 @@ class UploadFromChunks extends UploadFromFile { * * @param string $chunkPath * @throws UploadChunkFileException - * @return FileRepoStatus + * @return Status */ private function outputChunk( $chunkPath ) { // Key is fileKey + chunk index