From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/upload/UploadFromUrl.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'includes/upload/UploadFromUrl.php') diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index 8178988f..da772fe2 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -2,27 +2,28 @@ /** * Implements uploading from a HTTP resource. * - * @file - * @ingroup upload + * @ingroup Upload * @author Bryan Tong Minh * @author Michael Dale */ - class UploadFromUrl extends UploadBase { protected $mAsync, $mUrl; protected $mIgnoreWarnings = true; - protected $mTempPath; + protected $mTempPath, $mTmpHandle; /** * Checks if the user is allowed to use the upload-by-URL feature. If the * user is allowed, pass on permissions checking to the parent. * * @param $user User + * + * @return bool */ public static function isAllowed( $user ) { - if ( !$user->isAllowed( 'upload_by_url' ) ) + if ( !$user->isAllowed( 'upload_by_url' ) ) { return 'upload_by_url'; + } return parent::isAllowed( $user ); } @@ -64,8 +65,9 @@ class UploadFromUrl extends UploadBase { */ public function initializeFromRequest( &$request ) { $desiredDestName = $request->getText( 'wpDestFile' ); - if ( !$desiredDestName ) + if ( !$desiredDestName ) { $desiredDestName = $request->getText( 'wpUploadFileURL' ); + } return $this->initialize( $desiredDestName, trim( $request->getVal( 'wpUploadFileURL' ) ), @@ -75,6 +77,7 @@ class UploadFromUrl extends UploadBase { /** * @param $request WebRequest object + * @return bool */ public static function isValidRequest( $request ) { global $wgUser; @@ -85,8 +88,14 @@ class UploadFromUrl extends UploadBase { && $wgUser->isAllowed( 'upload_by_url' ); } + /** + * @return string + */ public function getSourceType() { return 'url'; } + /** + * @return Status + */ public function fetchFile() { if ( !Http::isValidURI( $this->mUrl ) ) { return Status::newFatal( 'http-invalid-url' ); @@ -130,6 +139,7 @@ class UploadFromUrl extends UploadBase { /** * Download the file, save it to the temporary file and update the file * size and set $mRemoveTempFile to true. + * @return Status */ protected function reallyFetchFile() { if ( $this->mTempPath === false ) { @@ -209,9 +219,7 @@ class UploadFromUrl extends UploadBase { if ( $this->mAsync ) { $sessionKey = $this->insertJob( $comment, $pageText, $watch, $user ); - $status = new Status; - $status->error( 'async', $sessionKey ); - return $status; + return Status::newFatal( 'async', $sessionKey ); } return parent::performUpload( $comment, $pageText, $watch, $user ); -- cgit v1.2.3-54-g00ecf