* ( bug 19930 ) default to SYNC_DOWNLOAD
authorMichael Dale <dale@users.mediawiki.org>
Mon, 27 Jul 2009 19:00:27 +0000 (19:00 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 27 Jul 2009 19:00:27 +0000 (19:00 +0000)
includes/HttpFunctions.php
includes/api/ApiUpload.php
includes/upload/UploadFromUrl.php

index 868bb02..849ff7c 100644 (file)
@@ -80,7 +80,7 @@ class Http {
                        wfDebug( __METHOD__ . "\ASYNC_DOWNLOAD\n" );
                        // setup session and shell call:
                        return self::initBackgroundDownload( $url, $target_file_path, $content_length );
-               } else if( $dl_mode == self::SYNC_DOWNLOAD ){
+               } else {
                        wfDebug( __METHOD__ . "\nSYNC_DOWNLOAD\n" );
                        // SYNC_DOWNLOAD download as much as we can in the time we have to execute
                        $opts['method'] = 'GET';
@@ -196,17 +196,17 @@ class Http {
                // if status okay process upload using fauxReq to api:
                if( $status->isOK() ){
                        // setup the FauxRequest
-                       $fauxReqData = $sd['mParams'];          
-                               
+                       $fauxReqData = $sd['mParams'];
+
                        // Fix boolean parameters
                        foreach( $fauxReqData as $k => $v ) {
                                if( $v === false )
                                        unset( $fauxReqData[$k] );
                        }
-                       
+
                        $fauxReqData['action'] = 'upload';
                        $fauxReqData['format'] = 'json';
-                       $fauxReqData['internalhttpsession'] = $upload_session_key;                      
+                       $fauxReqData['internalhttpsession'] = $upload_session_key;
                        // evil but no other clean way about it:
                        $faxReq = new FauxRequest( $fauxReqData, true );
                        $processor = new ApiMain( $faxReq, $wgEnableWriteAPI );
@@ -347,9 +347,9 @@ class HttpRequest {
 
                // set the write back function (if we are writing to a file)
                if( $this->target_file_path ){
-                       $cwrite = new simpleFileWriter( $this->target_file_path, 
-                               $this->upload_session_key, 
-                               $this->do_close_session_update 
+                       $cwrite = new simpleFileWriter( $this->target_file_path,
+                               $this->upload_session_key,
+                               $this->do_close_session_update
                        );
                        if( !$cwrite->status->isOK() ){
                                wfDebug( __METHOD__ . "ERROR in setting up simpleFileWriter\n" );
@@ -508,7 +508,7 @@ class simpleFileWriter {
                $this->target_file_path = $target_file_path;
                $this->upload_session_key = $upload_session_key;
                $this->status = Status::newGood();
-               $this->do_close_session_update = $do_close_session_update;              
+               $this->do_close_session_update = $do_close_session_update;
                // open the file:
                $this->fp = fopen( $this->target_file_path, 'w' );
                if( $this->fp === false ){
index 1bb2935..b4e0dda 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  * Created on Aug 21, 2008
  * API for MediaWiki 1.8+
index 8765a3b..b543070 100644 (file)
@@ -4,7 +4,7 @@ class UploadFromUrl extends UploadBase {
        protected $mTempDownloadPath;
 
        // by default do a SYNC_DOWNLOAD
-       protected $dl_mode = null;
+       protected $dl_mode =  Http::SYNC_DOWNLOAD;
 
        /**
         * Checks if the user is allowed to use the upload-by-URL feature