Index: branches/new-upload/phase3/includes/UploadFromUrl.php |
— | — | @@ -15,10 +15,10 @@ |
16 | 16 | return $wgAllowCopyUploads && parent::isEnabled(); |
17 | 17 | } |
18 | 18 | /*entry point for Api upload:: ASYNC_DOWNLOAD (if possible) */ |
19 | | - function initialize( $name, $url ) { |
20 | | - global $wgTmpDirectory, $wgPhpCliPath; |
| 19 | + function initialize( $name, $url, $asyncdownload) { |
| 20 | + global $wgTmpDirectory, $wgPhpCliPath; |
21 | 21 | |
22 | | - if(!$this->dl_mode && $wgPhpCliPath && wfShellExecEnabled() ){ |
| 22 | + if($asyncdownload && $wgPhpCliPath && wfShellExecEnabled() ){ |
23 | 23 | $this->dl_mode = Http::ASYNC_DOWNLOAD; |
24 | 24 | }else{ |
25 | 25 | $this->dl_mode = Http::SYNC_DOWNLOAD; |
Index: branches/new-upload/phase3/includes/api/ApiUpload.php |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | } elseif( isset( $this->mParams['url'] ) ) { |
123 | 123 | |
124 | 124 | $this->mUpload = new UploadFromUrl(); |
125 | | - $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url']); |
| 125 | + $this->mUpload->initialize( $this->mParams['filename'], $this->mParams['url'], $this->mParam['asyncdownload']); |
126 | 126 | |
127 | 127 | $status = $this->mUpload->fetchFile(); |
128 | 128 | if( !$status->isOK() ){ |
— | — | @@ -287,6 +287,7 @@ |
288 | 288 | 'comment' => array( |
289 | 289 | ApiBase :: PARAM_DFLT => '' |
290 | 290 | ), |
| 291 | + 'asyncdownload'=>false, |
291 | 292 | 'watch' => false, |
292 | 293 | 'ignorewarnings' => false, |
293 | 294 | 'done' => false, |
— | — | @@ -305,6 +306,8 @@ |
306 | 307 | 'url' => 'Url to upload from', |
307 | 308 | 'enablechunks' => 'Boolean If we are in chunk mode; accepts many small file POSTs', |
308 | 309 | 'comment' => 'Upload comment or initial page text', |
| 310 | + 'asyncdownload' => 'If we should download asyncrously (returns a upload session key to get status updates)'. |
| 311 | + "\nDefault:false", |
309 | 312 | 'watch' => 'Watch the page', |
310 | 313 | 'ignorewarnings' => 'Ignore any warnings', |
311 | 314 | 'done' => 'When used with "chunks", Is sent to notify the api The last chunk is being uploaded.', |