r55605 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55604‎ | r55605 | r55606 >
Date:17:08, 26 August 2009
Author:btongminh
Status:resolved (Comments)
Tags:
Comment:
Removed the $tmpFile parameter to UploadBase::verifyUpload in favour of $this->mTempFile.
Modified paths:
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadFromChunks.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadFromStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadFromStash.php
@@ -56,7 +56,7 @@
5757 /**
5858 * File has been previously verified so no need to do so again.
5959 */
60 - protected function verifyFile( $tmpfile ) {
 60+ protected function verifyFile() {
6161 return true;
6262 }
6363
Index: trunk/phase3/includes/upload/UploadBase.php
@@ -170,7 +170,7 @@
171171 * type but it's corrupt or data of the wrong type, we should
172172 * probably not accept it.
173173 */
174 - $verification = $this->verifyFile( $this->mTempPath );
 174+ $verification = $this->verifyFile();
175175
176176 if( $verification !== true ) {
177177 if( !is_array( $verification ) )
@@ -196,13 +196,13 @@
197197 * @param string $tmpfile the full path of the temporary file to verify
198198 * @return mixed true of the file is verified, a string or array otherwise.
199199 */
200 - protected function verifyFile( $tmpfile ) {
 200+ protected function verifyFile() {
201201 $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
202202 $this->checkMacBinary();
203203
204204 #magically determine mime type
205205 $magic = MimeMagic::singleton();
206 - $mime = $magic->guessMimeType( $tmpfile, false );
 206+ $mime = $magic->guessMimeType( $this->mTempFile, false );
207207
208208 #check mime type, if desired
209209 global $wgVerifyMimeType;
@@ -212,7 +212,7 @@
213213 return array( 'filetype-badmime', $mime );
214214
215215 # Check IE type
216 - $fp = fopen( $tmpfile, 'rb' );
 216+ $fp = fopen( $this->mTempFile, 'rb' );
217217 $chunk = fread( $fp, 256 );
218218 fclose( $fp );
219219 $extMime = $magic->guessTypesForExtension( $this->mFinalExtension );
Index: trunk/phase3/includes/upload/UploadFromChunks.php
@@ -88,7 +88,7 @@
8989 }
9090
9191 // only run verifyFile on completed uploaded chunks
92 - function verifyFile( $tmpFile ){
 92+ function verifyFile(){
9393 if( $this->chunk_mode == UploadFromChunks::DONE ){
9494 // first append last chunk (so we can do a real verifyFile check... (check file type etc)
9595 $status = $this->doChunkAppend();

Comments

#Comment by Brion VIBBER (talk | contribs)   17:44, 27 August 2009

mTempFile doesn't exist. Seems to have been since fixed to mTempPath, which does.

Status & tagging log