From af198296ef37eba89df1723075e84f58a83d6c9f Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 22 Jan 2012 17:33:44 +0000 Subject: [PATCH] Revert feature out of r109562, r109564, r109570 Leaving typo/brace fixes and other minor code improvements --- RELEASE-NOTES-1.19 | 1 - includes/DefaultSettings.php | 4 ---- includes/api/ApiBase.php | 1 - includes/api/ApiUpload.php | 4 ---- includes/upload/UploadFromUrl.php | 25 ------------------------- languages/messages/MessagesEn.php | 1 - maintenance/language/messages.inc | 1 - 7 files changed, 37 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index b6789634cb..b7d11648c4 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -123,7 +123,6 @@ production. * (bug 29309) Allow CSS class per tooltip (tipsy). * (bug 33565) Add accesskey/tooltip to submit buttons on Special:EditWatchlist. * (bug 17959) Inline rendering/thumbnailing for Gimp XCF images. -* (bug 32341) Add upload by URL domain limitation. === Bug fixes in 1.19 === * $wgUploadNavigationUrl should be used for file redlinks if. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 6bc3445e2e..088a5f930e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -453,10 +453,6 @@ $wgAllowCopyUploads = false; * This feature is experimental and broken as of r81612. */ $wgAllowAsyncCopyUploads = false; -/** - * A list of domains copy uploads can come from - */ -$wgCopyUploadsDomains = array(); /** * Max size for uploads, in bytes. If not set to an array, applies to all diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 6105dec227..133339a1b3 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1231,7 +1231,6 @@ abstract class ApiBase extends ContextSource { 'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ), 'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ), 'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ), - 'copyuploadbaddomain' => array( 'code' => 'copyuploadbaddomain', 'info' => 'Uploads by URL are not allowed from this domain.' ), 'filename-tooshort' => array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ), 'filename-toolong' => array( 'code' => 'filename-toolong', 'info' => 'The filename is too long' ), diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 60016512b0..fdc1eff080 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -318,10 +318,6 @@ class ApiUpload extends ApiBase { $this->dieUsageMsg( 'copyuploaddisabled' ); } - if ( !UploadFromUrl::isAllowedHost( $this->mParams['url'] ) ) { - $this->dieUsageMsg( 'copyuploadbaddomain' ); - } - $async = false; if ( $this->mParams['asyncdownload'] ) { $this->checkAsyncDownloadEnabled(); diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index 55a9c80fa6..83f1babbe1 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -37,28 +37,6 @@ class UploadFromUrl extends UploadBase { return $wgAllowCopyUploads && parent::isEnabled(); } - /** - * Checks whether the URL is for an allowed host - * - * @param $url string - * @return bool - */ - public static function isAllowedHost( $url ) { - global $wgCopyUploadsDomains; - if ( !count( $wgCopyUploadsDomains ) ) { - return true; - } - $valid = false; - $parsedUrl = wfParseUrl( $url ); - foreach( $wgCopyUploadsDomains as $domain ) { - if ( $parsedUrl['host'] === $domain ) { - $valid = true; - break; - } - } - return $valid; - } - /** * Entry point for API upload * @@ -124,9 +102,6 @@ class UploadFromUrl extends UploadBase { return Status::newFatal( 'http-invalid-url' ); } - if( !self::isAllowedHost( $this->mUrl ) ) { - return Status::newFatal( 'upload-copy-upload-invalid-domain' ); - } if ( !$this->mAsync ) { return $this->reallyFetchFile(); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index c93ce4e480..a0c76d32eb 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2235,7 +2235,6 @@ If the problem persists, contact an [[Special:ListUsers/sysop|administrator]].', 'upload-too-many-redirects' => 'The URL contained too many redirects', 'upload-unknown-size' => 'Unknown size', 'upload-http-error' => 'An HTTP error occured: $1', -'upload-copy-upload-invalid-domain' => 'Copy uploads are not available from this domain.', # File backend 'backend-fail-stream' => 'Could not stream file $1.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 6a7dd2e734..02fe7aebd3 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1344,7 +1344,6 @@ $wgMessageStructure = array( 'upload-too-many-redirects', 'upload-unknown-size', 'upload-http-error', - 'upload-copy-upload-invalid-domain', ), 'filebackend-errors' => array( -- 2.20.1