From: Reedy Date: Fri, 28 Sep 2012 00:33:48 +0000 (+0100) Subject: Add $wgCopyUploadProxy to be used for copy uploads only. X-Git-Tag: 1.31.0-rc.0~22243 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=74760579254fd51e9872ffbf4fb46307f0cf62f5;p=lhc%2Fweb%2Fwiklou.git 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 --- 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();