From 74760579254fd51e9872ffbf4fb46307f0cf62f5 Mon Sep 17 00:00:00 2001 From: Reedy Date: Fri, 28 Sep 2012 01:33:48 +0100 Subject: [PATCH] Add $wgCopyUploadProxy to be used for copy uploads only. Means we don't break stuff on the cluster such as search by setting $wgHTTPProxy Change-Id: I094b2bfd097e7e5c1c45b6332357d959ed95ac99 --- includes/DefaultSettings.php | 6 ++++++ includes/upload/UploadFromUrl.php | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 19670bfc60..6d67428c59 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -530,6 +530,12 @@ $wgAllowAsyncCopyUploads = false; */ $wgCopyUploadsDomains = array(); +/** + * Proxy to use for copy upload requests. + * @since 1.20 + */ +$wgCopyUploadProxy = false; + /** * Max size for uploads, in bytes. If not set to an array, applies to all * uploads. If set to an array, per upload type maximums can be set, using the diff --git a/includes/upload/UploadFromUrl.php b/includes/upload/UploadFromUrl.php index c11d7192a4..927c3cd9d5 100644 --- a/includes/upload/UploadFromUrl.php +++ b/includes/upload/UploadFromUrl.php @@ -207,9 +207,14 @@ class UploadFromUrl extends UploadBase { $this->mRemoveTempFile = true; $this->mFileSize = 0; - $req = MWHttpRequest::factory( $this->mUrl, array( + $options = array( 'followRedirects' => true - ) ); + ); + global $wgCopyUploadProxy; + if ( $wgCopyUploadProxy !== false ) { + $options['proxy'] = $wgCopyUploadProxy; + } + $req = MWHttpRequest::factory( $this->mUrl, $options ); $req->setCallback( array( $this, 'saveTempFileChunk' ) ); $status = $req->execute(); -- 2.20.1