Removed the $tmpFile parameter to UploadBase::verifyUpload in favour of $this->mTempFile.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 26 Aug 2009 17:08:49 +0000 (17:08 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 26 Aug 2009 17:08:49 +0000 (17:08 +0000)
includes/upload/UploadBase.php
includes/upload/UploadFromChunks.php
includes/upload/UploadFromStash.php

index 52bb248..aeca23d 100644 (file)
@@ -170,7 +170,7 @@ abstract class UploadBase {
                 * type but it's corrupt or data of the wrong type, we should
                 * probably not accept it.
                 */
-               $verification = $this->verifyFile( $this->mTempPath );
+               $verification = $this->verifyFile();
 
                if( $verification !== true ) {
                        if( !is_array( $verification ) )
@@ -196,13 +196,13 @@ abstract class UploadBase {
         * @param string $tmpfile the full path of the temporary file to verify
         * @return mixed true of the file is verified, a string or array otherwise.
         */
-       protected function verifyFile( $tmpfile ) {
+       protected function verifyFile() {
                $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
                $this->checkMacBinary();
 
                #magically determine mime type
                $magic = MimeMagic::singleton();
-               $mime = $magic->guessMimeType( $tmpfile, false );
+               $mime = $magic->guessMimeType( $this->mTempFile, false );
 
                #check mime type, if desired
                global $wgVerifyMimeType;
@@ -212,7 +212,7 @@ abstract class UploadBase {
                                return array( 'filetype-badmime', $mime );
 
                        # Check IE type
-                       $fp = fopen( $tmpfile, 'rb' );
+                       $fp = fopen( $this->mTempFile, 'rb' );
                        $chunk = fread( $fp, 256 );
                        fclose( $fp );
                        $extMime = $magic->guessTypesForExtension( $this->mFinalExtension );
index a77ac7f..3ac5401 100644 (file)
@@ -88,7 +88,7 @@ class UploadFromChunks extends UploadBase {
        }
 
        // only run verifyFile on completed uploaded chunks
-       function verifyFile( $tmpFile ){
+       function verifyFile(){
                if( $this->chunk_mode == UploadFromChunks::DONE ){
                        // first append last chunk (so we can do a real verifyFile check... (check file type etc)
                        $status = $this->doChunkAppend();
index 06eb163..cd1d859 100644 (file)
@@ -56,7 +56,7 @@ class UploadFromStash extends UploadBase {
        /**
         * File has been previously verified so no need to do so again.
         */
-       protected function verifyFile( $tmpfile ) {
+       protected function verifyFile() {
                return true;
        }