From 55a48577cd07277906fa8cbb45e2fcc76ca0927b Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 9 May 2013 18:09:20 -0400 Subject: [PATCH] (bug 48294) API: Fix chunk upload async mode I915c1678 fixed single-chunk chunked uploads for the common case, but didn't store the data for async uploads under the correct filekey. This fixes that. Bug: 48294 Change-Id: Idbeab2fd0d801974b610198dcf02c81798f65a0d --- RELEASE-NOTES-1.22 | 1 + includes/api/ApiUpload.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index a26c7d8541..0708e6be75 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -115,6 +115,7 @@ production. * (bug 30213) JavaScript for search suggestions is now disabled when the API is disabled, and AJAX patrolling and watching are now disabled when use of the write API is not allowed. +* (bug 48294) API: Fix chunk upload async mode. === API changes in 1.22 === * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index e04c76214b..8f71fbe6a2 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -216,27 +216,27 @@ class ApiUpload extends ApiBase { // Check we added the last chunk: if ( $this->mParams['offset'] + $chunkSize == $this->mParams['filesize'] ) { if ( $this->mParams['async'] ) { - $progress = UploadBase::getSessionStatus( $this->mParams['filekey'] ); + $progress = UploadBase::getSessionStatus( $filekey ); if ( $progress && $progress['result'] === 'Poll' ) { $this->dieUsage( "Chunk assembly already in progress.", 'stashfailed' ); } UploadBase::setSessionStatus( - $this->mParams['filekey'], + $filekey, array( 'result' => 'Poll', 'stage' => 'queued', 'status' => Status::newGood() ) ); $ok = JobQueueGroup::singleton()->push( new AssembleUploadChunksJob( - Title::makeTitle( NS_FILE, $this->mParams['filekey'] ), + Title::makeTitle( NS_FILE, $filekey ), array( 'filename' => $this->mParams['filename'], - 'filekey' => $this->mParams['filekey'], + 'filekey' => $filekey, 'session' => $this->getContext()->exportSession() ) ) ); if ( $ok ) { $result['result'] = 'Poll'; } else { - UploadBase::setSessionStatus( $this->mParams['filekey'], false ); + UploadBase::setSessionStatus( $filekey, false ); $this->dieUsage( "Failed to start AssembleUploadChunks.php", 'stashfailed' ); } -- 2.20.1