r63636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63635‎ | r63636 | r63637 >
Date:18:12, 12 March 2010
Author:btongminh
Status:ok
Tags:
Comment:
Pass $sessionKey as parameter to UploadFromStash::initialize.
This fixes an issue with ApiUpload where a file gets restashed when warnings still occur with a stashed upload.
Modified paths:
  • /branches/REL1_16/phase3/includes/api/ApiUpload.php (modified) (history)
  • /branches/REL1_16/phase3/includes/upload/UploadFromStash.php (modified) (history)

Diff [purge]

Index: branches/REL1_16/phase3/includes/upload/UploadFromStash.php
@@ -24,10 +24,8 @@
2525 $sessionData
2626 );
2727 }
28 - /*
29 - * some $na vars for uploadBase method compatibility.
30 - */
31 - public function initialize( $name, $sessionData, $na=false, $na2=false ) {
 28+
 29+ public function initialize( $name, $sessionKey, $sessionData ) {
3230 /**
3331 * Confirming a temporarily stashed upload.
3432 * We don't want path names to be forged, so we keep
@@ -40,19 +38,20 @@
4139 $sessionData['mFileSize'],
4240 false
4341 );
44 -
 42+
 43+ $this->mSessionKey = $sessionKey;
4544 $this->mVirtualTempPath = $sessionData['mTempPath'];
4645 $this->mFileProps = $sessionData['mFileProps'];
4746 }
4847
4948 public function initializeFromRequest( &$request ) {
50 - $this->mSessionKey = $request->getInt( 'wpSessionKey' );
 49+ $sessionKey = $request->getInt( 'wpSessionKey' );
5150 $sessionData = $request->getSessionData('wsUploadData');
5251
5352 $desiredDestName = $request->getText( 'wpDestFile' );
5453 if( !$desiredDestName )
5554 $desiredDestName = $request->getText( 'wpUploadFile' );
56 - return $this->initialize( $desiredDestName, $sessionData[$this->mSessionKey], false );
 55+ return $this->initialize( $desiredDestName, $sessionKey, $sessionData[$sessionKey] );
5756 }
5857
5958 /**
Index: branches/REL1_16/phase3/includes/api/ApiUpload.php
@@ -64,6 +64,7 @@
6565
6666 $this->mUpload = new UploadFromStash();
6767 $this->mUpload->initialize( $this->mParams['filename'],
 68+ $this->mParams['sessionkey'],
6869 $_SESSION['wsUploadData'][$this->mParams['sessionkey']] );
6970 } elseif ( isset( $this->mParams['filename'] ) ) {
7071 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r63638Merge r63621 and r63636 from REL1_16:...btongminh18:26, 12 March 2010

Status & tagging log