class UploadFromUrl extends UploadBase {
protected $mTempDownloadPath;
- // by default do a SYNC_DOWNLOAD
- protected $dl_mode = null;
+ // by default do a SYNC_DOWNLOAD
+ protected $dl_mode = Http::SYNC_DOWNLOAD;
/**
* Checks if the user is allowed to use the upload-by-URL feature
}
/* entry point for API upload:: ASYNC_DOWNLOAD (if possible) */
- function initialize( $name, $url, $asyncdownload = false ) {
- global $wgTmpDirectory, $wgPhpCliPath;
+ function initialize( $name, $url, $asyncdownload, $na = false ) {
+ global $wgTmpDirectory, $wgPhpCli;
- // check for $asyncdownload request:
+ // check for $asyncdownload request:
if( $asyncdownload !== false){
- if( $wgPhpCliPath && wfShellExecEnabled() ){
+ if( $wgPhpCli && wfShellExecEnabled() ){
$this->dl_mode = Http::ASYNC_DOWNLOAD;
} else {
$this->dl_mode = Http::SYNC_DOWNLOAD;
// set dl mode if not set:
if( !$this->dl_mode )
- $this->dl_mode = Http::SYNC_DOWNLOAD;
+ $this->dl_mode = Http::SYNC_DOWNLOAD;
$desiredDestName = $request->getText( 'wpDestFile' );
if( !$desiredDestName )
$desiredDestName = $request->getText( 'wpUploadFile' );
return $this->initialize(
$desiredDestName,
- $request->getVal( 'wpUploadFileURL' )
+ $request->getVal( 'wpUploadFileURL' ),
+ false
);
}
* Do the real fetching stuff
*/
function fetchFile() {
- // entry point for SpecialUplaod
+ // entry point for SpecialUplaod
if( self::isValidURI( $this->mUrl ) === false ) {
return Status::newFatal( 'upload-proto-error' );
}
// now do the actual download to the target file:
$status = Http::doDownload( $this->mUrl, $this->mTempPath, $this->dl_mode );
- // update the local filesize var:
+ // update the local filesize var:
$this->mFileSize = filesize( $this->mTempPath );
return $status;