r103258 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103257‎ | r103258 | r103259 >
Date:23:28, 15 November 2011
Author:neilk
Status:deferred
Tags:
Comment:
Update UploadWizard config to re-enable multi-file select, without chunking.
Fix UploadStash regressions from 1.17wmf1 that caused errors.
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/UploadWizard/resources/mw.FormDataTransport.js (modified) (history)
  • /branches/wmf/1.18wmf1/includes/upload/UploadFromStash.php (modified) (history)
  • /branches/wmf/1.18wmf1/includes/upload/UploadStash.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/UploadWizard/resources/mw.FormDataTransport.js
@@ -31,7 +31,7 @@
3232 file = this.uploadObject.file,
3333 bytesAvailable = file.size;
3434
35 - if(file.size > this.chunkSize) {
 35+ if( mw.UploadWizard.config[ 'enableChunked' ] && file.size > this.chunkSize ) {
3636 this.uploadChunk(0);
3737 } else {
3838 this.xhr = new XMLHttpRequest();
Index: branches/wmf/1.18wmf1/extensions/UploadWizard/UploadWizard.config.php
@@ -414,6 +414,9 @@
415415 'enableFormData' => true,
416416
417417 // should multi-file select be available in supporting browsers?
418 - 'enableMultiFileSelect' => true
 418+ 'enableMultiFileSelect' => true,
419419
 420+ // should chunked uploading be enabled? false for now since the backend isn't really ready.
 421+ 'enableChunked' => false,
 422+
420423 );
Index: branches/wmf/1.18wmf1/includes/upload/UploadStash.php
@@ -415,7 +415,7 @@
416416 $res = $dbr->select(
417417 'uploadstash',
418418 'us_key',
419 - array( 'us_key' => $key ),
 419+ array( 'us_user' => $this->userId ),
420420 __METHOD__
421421 );
422422
Index: branches/wmf/1.18wmf1/includes/upload/UploadFromStash.php
@@ -29,7 +29,11 @@
3030 if( $stash ) {
3131 $this->stash = $stash;
3232 } else {
33 - wfDebug( __METHOD__ . " creating new UploadStash instance for " . $user->getId() . "\n" );
 33+ if( $user ) {
 34+ wfDebug( __METHOD__ . " creating new UploadStash instance for " . $user->getId() . "\n" );
 35+ } else {
 36+ wfDebug( __METHOD__ . " creating new UploadStash instance with no user\n" );
 37+ }
3438 $this->stash = new UploadStash( $this->repo, $this->user );
3539 }
3640
@@ -97,20 +101,20 @@
98102 }
99103
100104 /**
101 - * There is no need to stash the image twice
 105+ * Stash the file.
102106 */
103 - public function stashFile( $key = null ) {
104 - if ( !empty( $this->mLocalFile ) ) {
105 - return $this->mLocalFile;
106 - }
107 - return parent::stashFile( $key );
 107+ public function stashFile( $key = null ) {
 108+ // replace mLocalFile with an instance of UploadStashFile, which adds some methods
 109+ // that are useful for stashed files.
 110+ $this->mLocalFile = parent::stashFile( $key );
 111+ return $this->mLocalFile;
108112 }
109113
110114 /**
111 - * Alias for stashFile
 115+ * This should return the key instead of the UploadStashFile instance, for backward compatibility.
112116 */
113117 public function stashSession( $key = null ) {
114 - return $this->stashFile( $key );
 118+ return $this->stashFile( $key )->getFileKey();
115119 }
116120
117121 /**

Status & tagging log