From: rillke Date: Thu, 12 Feb 2015 15:59:09 +0000 (+0100) Subject: Chunked upload: Return expected offset on offset error X-Git-Tag: 1.31.0-rc.0~12400^2 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=9853803750059518cb51c035ab9fedc67fe0aedc;p=lhc%2Fweb%2Fwiklou.git Chunked upload: Return expected offset on offset error Bug: T87535 Change-Id: If68e0075e73a78c1dd8d95839f7ee9374a995201 --- diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 62d8882898..78a497144f 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -218,7 +218,11 @@ class ApiUpload extends ApiBase { $status = $this->mUpload->addChunk( $chunkPath, $chunkSize, $this->mParams['offset'] ); if ( !$status->isGood() ) { - $this->dieUsage( $status->getWikiText(), 'stashfailed' ); + $extradata = array( + 'offset' => $this->mUpload->getOffset(), + ); + + $this->dieUsage( $status->getWikiText(), 'stashfailed', 0, $extradata ); return array(); } diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 8e6c9c6061..3c249ce9ee 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -303,10 +303,10 @@ class UploadFromChunks extends UploadFromFile { } /** - * Gets the current offset in fromt the stashedupload table + * Get the offset at which the next uploaded chunk will be appended to * @return int Current byte offset of the chunk file set */ - private function getOffset() { + public function getOffset() { if ( $this->mOffset !== null ) { return $this->mOffset; }