Index: branches/wmf/1.18wmf1/extensions/UploadWizard/resources/mw.FormDataTransport.js |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | file = this.uploadObject.file, |
33 | 33 | bytesAvailable = file.size; |
34 | 34 | |
35 | | - if(file.size > this.chunkSize) { |
| 35 | + if( mw.UploadWizard.config[ 'enableChunked' ] && file.size > this.chunkSize ) { |
36 | 36 | this.uploadChunk(0); |
37 | 37 | } else { |
38 | 38 | this.xhr = new XMLHttpRequest(); |
Index: branches/wmf/1.18wmf1/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -414,6 +414,9 @@ |
415 | 415 | 'enableFormData' => true, |
416 | 416 | |
417 | 417 | // should multi-file select be available in supporting browsers? |
418 | | - 'enableMultiFileSelect' => true |
| 418 | + 'enableMultiFileSelect' => true, |
419 | 419 | |
| 420 | + // should chunked uploading be enabled? false for now since the backend isn't really ready. |
| 421 | + 'enableChunked' => false, |
| 422 | + |
420 | 423 | ); |
Index: branches/wmf/1.18wmf1/includes/upload/UploadStash.php |
— | — | @@ -415,7 +415,7 @@ |
416 | 416 | $res = $dbr->select( |
417 | 417 | 'uploadstash', |
418 | 418 | 'us_key', |
419 | | - array( 'us_key' => $key ), |
| 419 | + array( 'us_user' => $this->userId ), |
420 | 420 | __METHOD__ |
421 | 421 | ); |
422 | 422 | |
Index: branches/wmf/1.18wmf1/includes/upload/UploadFromStash.php |
— | — | @@ -29,7 +29,11 @@ |
30 | 30 | if( $stash ) { |
31 | 31 | $this->stash = $stash; |
32 | 32 | } 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 | + } |
34 | 38 | $this->stash = new UploadStash( $this->repo, $this->user ); |
35 | 39 | } |
36 | 40 | |
— | — | @@ -97,20 +101,20 @@ |
98 | 102 | } |
99 | 103 | |
100 | 104 | /** |
101 | | - * There is no need to stash the image twice |
| 105 | + * Stash the file. |
102 | 106 | */ |
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; |
108 | 112 | } |
109 | 113 | |
110 | 114 | /** |
111 | | - * Alias for stashFile |
| 115 | + * This should return the key instead of the UploadStashFile instance, for backward compatibility. |
112 | 116 | */ |
113 | 117 | public function stashSession( $key = null ) { |
114 | | - return $this->stashFile( $key ); |
| 118 | + return $this->stashFile( $key )->getFileKey(); |
115 | 119 | } |
116 | 120 | |
117 | 121 | /** |