r62353 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62352‎ | r62353 | r62354 >
Date:06:28, 12 February 2010
Author:mah
Status:ok (Comments)
Tags:
Comment:
Final(?) changes to enable chunked uploading.
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUpload.php
@@ -138,8 +138,8 @@
139139 // Cleanup any temporary mess
140140 $this->mUpload->cleanupTempFile();
141141
142 - if( $this->mParams['enablechunks'] ) {
143 - foreach ($result as $key => $value) {
 142+ if( isset($result['chunked-output']) ) {
 143+ foreach ($result['chunked-output'] as $key => $value) {
144144 if($value === null) $value = "";
145145 $this->getResult()->addValue( null, $key, $value );
146146 }
@@ -249,7 +249,7 @@
250250
251251 $this->dieUsage( 'An internal error occurred', 'internal-error', 0, $error );
252252 } elseif( $this->mParams['enablechunks'] ) {
253 - return $status->value;
 253+ return array("chunked-output" => $status->value);
254254 }
255255
256256 $file = $this->mUpload->getLocalFile();
@@ -279,7 +279,7 @@
280280 'watch' => false,
281281 'ignorewarnings' => false,
282282 'file' => null,
283 - 'enablechunks' => false,
 283+ 'enablechunks' => null, /* must be null to work with requireOnlyOneParameter */
284284 'chunksession' => null,
285285 'chunk' => null,
286286 'done' => false,

Follow-up revisions

RevisionCommit summaryAuthorDate
r62498follow up r62353 Make ApiBase::requireOnlyOneParameter() accept parameters th...mah07:06, 15 February 2010

Comments

#Comment by Siebrand (talk | contribs)   08:18, 12 February 2010

Getting very weird output in the translatewiki.net PHP error log running this rev. Pasting some output below:

[12-Feb-2010 06:57:04] {"query":{"threads":[{"id":"1722","subject":"Glad to have you!","parent":null,"modified":"20100128170846"},{"id":"1908","subject":"\u0627\u0644\u0633\u0644\u0627\u0645 \u0648 \u0639\u0644\u06cc\u06a9\u0645","parent":null,"modified":"20100211224040"}]}} [12-Feb-2010 06:57:37] {"query":{"threads":[{"id":"1075","subject":"\u041e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0443\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 MantisBT","parent":null,"modified":"20100118144200"}]}}

The log also contained the complete API manual that's normally displayed requesting api.php.

#Comment by Catrope (talk | contribs)   13:15, 12 February 2010

This seems to be due to r62354 instead, see comment there.

#Comment by Siebrand (talk | contribs)   14:13, 12 February 2010

Correct. Fixed in r62367.

#Comment by Catrope (talk | contribs)   13:13, 12 February 2010
+			'enablechunks' => null, /* must be null to work with requireOnlyOneParameter */

Then requireOnlyOneParameter should be fixed. Boolean parameters should still use => false instead of => null

Status & tagging log