r93065 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93064‎ | r93065 | r93066 >
Date:16:55, 25 July 2011
Author:raindrift
Status:ok (Comments)
Tags:
Comment:
Changed storeResult to storeStatus (more informative), removed leftover stack trace call. Followup to r92009
Modified paths:
  • /trunk/phase3/includes/upload/UploadStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadStash.php
@@ -219,18 +219,18 @@
220220 wfDebug( __METHOD__ . " key for '$path': $key\n" );
221221
222222 // if not already in a temporary area, put it there
223 - $storeResult = $this->repo->storeTemp( basename( $path ), $path );
 223+ $storeStatus = $this->repo->storeTemp( basename( $path ), $path );
224224
225 - if ( ! $storeResult->isOK() ) {
 225+ if ( ! $storeStatus->isOK() ) {
226226 // It is a convention in MediaWiki to only return one error per API exception, even if multiple errors
227227 // are available. We use reset() to pick the "first" thing that was wrong, preferring errors to warnings.
228 - // This is a bit lame, as we may have more info in the $storeResult and we're throwing it away, but to fix it means
 228+ // This is a bit lame, as we may have more info in the $storeStatus and we're throwing it away, but to fix it means
229229 // redesigning API errors significantly.
230 - // $storeResult->value just contains the virtual URL (if anything) which is probably useless to the caller
231 - $error = $storeResult->getErrorsArray();
 230+ // $storeStatus->value just contains the virtual URL (if anything) which is probably useless to the caller
 231+ $error = $storeStatus->getErrorsArray();
232232 $error = reset( $error );
233233 if ( ! count( $error ) ) {
234 - $error = $storeResult->getWarningsArray();
 234+ $error = $storeStatus->getWarningsArray();
235235 $error = reset( $error );
236236 if ( ! count( $error ) ) {
237237 $error = array( 'unknown', 'no error recorded' );
@@ -238,11 +238,10 @@
239239 }
240240 throw new UploadStashFileException( "error storing file in '$path': " . implode( '; ', $error ) );
241241 }
242 - $stashPath = $storeResult->value;
 242+ $stashPath = $storeStatus->value;
243243
244244 // fetch the current user ID
245245 if ( !$this->isLoggedIn ) {
246 - wfDebugCallstack();
247246 throw new UploadStashNotLoggedInException( __METHOD__ . ' No user is logged in, files must belong to users' );
248247 }
249248

Follow-up revisions

RevisionCommit summaryAuthorDate
r102514REL1_18 MFT r92846, r93065, r93834, r94171reedy14:31, 9 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92009Refactored UploadStash and related classes to use the database for file metad...raindrift21:11, 12 July 2011

Comments

#Comment by MarkAHershberger (talk | contribs)   05:40, 5 November 2011

- wfDebugCallstack();

This bit must be removed from 1.18 since the it causes fatal errors from undefined functions.

#Comment by MarkAHershberger (talk | contribs)   05:42, 5 November 2011

To run into the problem:

curl -F 'action=upload' -F url=http://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Kokernot_Field_Rock_Wall_2010.jpg/120px-Kokernot_Field_Rock_Wall_2010.jp g -F format=json -F filename=file.jpg -F token=+\\ URL-FOR-API.PHP

(with sufficiently lax uploading permissions)

Status & tagging log