r93725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93724‎ | r93725 | r93726 >
Date:11:01, 2 August 2011
Author:j
Status:ok
Tags:
Comment:
use tabs. for consistant whitespaces
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUpload.php
@@ -91,9 +91,9 @@
9292 if( $this->mParams['filesize'] > $maxSize ) {
9393 $this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
9494 }
95 - } else {
 95+ } else {
9696 $this->verifyUpload();
97 - }
 97+ }
9898
9999
100100 // Check if the user has the rights to modify or overwrite the requested title
@@ -122,25 +122,25 @@
123123 $result['warnings']['stashfailed'] = $e->getMessage();
124124 }
125125 } elseif ( $this->mParams['chunk'] ) {
126 - $result['result'] = 'Continue';
 126+ $result['result'] = 'Continue';
127127 $chunk = $request->getFileTempName( 'chunk' );
128128 $chunkSize = $request->getFileSize( 'chunk' );
129 - if ($this->mParams['offset'] == 0) {
 129+ if ($this->mParams['offset'] == 0) {
130130 $result['filekey'] = $this->performStash();
131 - } else {
132 - $status = $this->mUpload->appendChunk($chunk, $chunkSize,
133 - $this->mParams['offset']);
134 - if ( !$status->isGood() ) {
135 - $this->dieUsage( $status->getWikiText(), 'stashfailed' );
136 - } else {
137 - $result['filekey'] = $this->mParams['filekey'];
138 - if($this->mParams['offset'] + $chunkSize == $this->mParams['filesize']) {
139 - $this->mUpload->finalizeFile();
140 - $result['result'] = 'Done';
141 - }
142 - }
143 - }
144 - $result['offset'] = $this->mParams['offset'] + $chunkSize;
 131+ } else {
 132+ $status = $this->mUpload->appendChunk($chunk, $chunkSize,
 133+ $this->mParams['offset']);
 134+ if ( !$status->isGood() ) {
 135+ $this->dieUsage( $status->getWikiText(), 'stashfailed' );
 136+ } else {
 137+ $result['filekey'] = $this->mParams['filekey'];
 138+ if($this->mParams['offset'] + $chunkSize == $this->mParams['filesize']) {
 139+ $this->mUpload->finalizeFile();
 140+ $result['result'] = 'Done';
 141+ }
 142+ }
 143+ }
 144+ $result['offset'] = $this->mParams['offset'] + $chunkSize;
145145 } elseif ( $this->mParams['stash'] ) {
146146 // Some uploads can request they be stashed, so as not to publish them immediately.
147147 // In this case, a failure to stash ought to be fatal

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93720Extend upload api adding an option to upload files in chunks,...j10:13, 2 August 2011

Status & tagging log